I am basically trying to do form validation. Evertyhing works great. Except one. Firstly, here is my code:
$('#submit_btn').click(function(){
$("input:not([type=radio],[type=checkbox])").each(function() {
if ($(this).val() == ""){
$('#'+$(this).attr("name")+'_error').show("");
}
else{
$('#'+$(this).attr("name")+'_error').hide("normal");
}
});
if(!($("div[id$=error]").is(":visible")))
alert("a");
});
After clicking the submit button, it checks the input, which is not a switch or flag. And if the input is empty, it shows an error.
If any input is entered, the error becomes hidden.
In the end, I check if any error message is displayed if I do not submit the form.
My problem: I hide the error message with a little animation with .hide ("normal"). Therefore, I believe that in the process of hiding the last error message, my last if statement is executed, and he believes that there is a visible error message (however, it was in the process of hiding)
How can I execute the if statement after the hide process is complete?
, , .
, . .
!