jQuery validate + ajaxSubmit on multiple forms
I'm trying to validate multiple forms in one single page with the jQuery validation plugin but it validates only the first form in the page.
Here is my code:
$('form.reply_form').validate({
submitHan开发者_Go百科dler: function(form) {
$(form).ajaxSubmit(optionsReplies);
return false;
}
});
Is for a list of reply forms in the page (image facebook). If I try to use the third form, for example, it validates the first one and if the first one is blank it wont submit.
Thank you in advance.
I'm not sure about the particular plugin you are using, but it sounds like it only uses the first element returned.
An each()
method may help:
$('form.reply_form').each(function(){
$(this).validate({
...
});
});
精彩评论