I have a form that is validated once the user "blur"s out of an input field. So:
$("#field1").blur(function() {
if($(this).val().length>0) {
$(this).attr('class', 'completed');
}
});
When the user first visits the form, and up until all fields are "completed", the submit button is hidden:
$(".submit").hide();
I want the submit button to slideDown once all #field1, #field2 ... elements have been assigned a "completed" class (any other method suggested will work as well).
I tried using:
$("#field1").blur(function() {
if($(".completed").length == $("input[type='text']").length) {
$(".submit").slideDown(1000);
}
});
But it didn't work as it was called concurrently with the previous "blur" handler.
Is there a method to bind an event handler to after another has triggered? Maybe a way to add a callback function to "blur" that works?
I'd appreciate all types of solution (not necessarily somethin like I presented).