I am using the jquery validate method to validate my form, I have written some code in submitHandler() method, However it taking time to execute. Please suggest me solution to overcome this issue.
$('#form').validate({
submitHandler:function(form) {
$('#loader').show();
$('#btnsubmit').hide();
$('#form').submit();
}
});
This code taking time to hide the button and submit the form, Suggest me the solution to overcome this issue.
Thanks in Advance!!!
You could try enabling debug
option to know why is taking time to execute, and with another event do the show hide
logic. For example:
// show hide logic
$('#form #btnsubmit').click(function(e){
$('#loader').show();
$('#btnsubmit').hide();
})
$('#form').validate({
// for debugging
debug: true,
submitHandler:function(form) {
$('#form').submit();
}
});