jquery validate() get current form in submitHandler

jquery, jquery-validate

Solution

You can use the `form` argument passed to the `submitHandler` method, it refers to the submitted form element. See the documentation for submitHandler

$("form.validate").each(function(){

     $(this).validate({
        submitHandler: function(form) {
           console.log(form, $(form));
        }
     });

});

Problem

I have a page with multiple forms to validate the code below works fine but I am having trouble when trying to access the $.validator object to get a reference of the validated form selector/id that is being stored as "currentForm" ``` $("form.validate").each(function(){ $(this).validate({ submitHandler: function(form) { console.log($(this)); } }); }); ``` The Console.log == ``` [$.validator, init: function, selector: "", jquery: "1.4.2", size: function, toArray: function…] 0: $.validator containers: c.fn.c.init[0] currentElements: c.fn.c.init[12] currentForm: form#thisForm1.validate ... ``` Why doesnt - $.validator.currentForm give me the value for currentForm? I have tried validator.currentForm.id & validator.currentForm as well as many other combos. Any ideas on how I can get that value to use in my submitHandler to reference the subbed form.

Original source