Tigraine

Daniel Hoelbling-Inzko talks about programming

jQuery.validate and multiple forms on one page

Posted by Daniel Hölbling on August 31, 2011

I like generic, convention based approaches to infrastructure so in most of my projects you'll find something like this in the main javascript file:

$('form').validate();
There is only one slight problem: jQuery validate doesn't work like most jQuery plugins and won't operate on the matched set, but rather only on the first element.

So if you want to validate multiple forms you have to call each form individually through each

$('form').each(function () {
    $(this).validate();
});

comments powered by Disqus

My Photography business

Projects

dynamic css for .NET

Archives

more