Acoording to this post (and many others), I wrote this function:
function cssDisplay(block,none){
block.css('display','block');
none.css('display','none');
}
Then, when calling it, I need just one parameter (block or none), like this:
email.keyup(function(){
if(email.hasClass('has-error')) {
cssDisplay(errorEmail,undefined);
}else{
button.prop("disabled", false);
cssDisplay(undefined,errorEmail);
}
});
But it only works for the display block. When the input gets valid, the error message won't go away, so I'm missing something. Can someone help me out?