views:

186

answers:

1

Hello there. 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({

submitHandler: 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.

A: 

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({
        ...
    });
});
tb