Hey. The script verifies the reliability of the password, the question is: when you add each new character, the block re-appears smoothly (the security level goes out in the block). How to make each security level show only once smoothly?
<div id="bg"> <p id="result"></p> <p id="bg_res"></p> </div> ===
function check(pass) { var protect = 0; $("#bg").hide().fadeIn(500); if(pass.length < 8) { $("#bg_res").removeClass(); $("#bg_res").addClass('red'); return "Слабый"; } //a,s,d,f var small = "([az]+)"; if(pass.match(small)) { protect++; } //A,B,C,D var big = "([AZ]+)"; if(pass.match(big)) { protect++; } //1,2,3,4,5 ... 0 var numb = "([0-9]+)"; if(pass.match(numb)) { protect++; } //!@#$ if(pass.match(/\W/)) { protect++; } if(protect == 2) { $("#bg_res").removeClass(); $("#bg_res").addClass('yellow'); return "Средний"; } if(protect == 3) { $("#bg_res").removeClass(); $("#bg_res").addClass('green'); return "Хороший"; } if(protect == 4) { $("#bg_res").removeClass(); $("#bg_res").addClass('green_v'); return "Высокий"; } }