jQuery Validate Issue with form.reset and validator.resetForm -


i have form required fields. if user clicks button, validation should fire, , input processed. however, after processing, want reset/clear form , allow them enter more information. after call form.reset() , validator.resetform() though, validation messages shown because form has been cleared. proper way clear form , ensure no validation messages appear? here's complete fiddle illustrating issue. here's code snippet i'd working:

$('#btngo').click(function(){     // clear form     $('#frmfoo')[0].reset();     // after call resetform, validation message shown again.  why?     validator.resetform(); }); 

thanks,

andy

the jquery validate plugin, default, treats button element submit, why validation messages come right during/after reset.

you need add type="button" button doesn't trigger submit.

<button type="button" id="btngo">do , clear form</button> 

demo: http://jsfiddle.net/axucf/1/


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -