views:

146

answers:

2

I have done various tests and i have found that the jquery validate function works only with the submit button. Am I right? If yes how can I use the jquery validate oplugins without the submit button?

A: 

You can use the method valid() to invoke the validator directly.

It will return bool indicating whether the form is valid or not.

Here is an example, from jQuery documentation:

$("#myform").validate();
$("a.check").click(function() {
    alert("Valid: " + $("#myform").valid());
    return false;
});
Sagi
A: 

When you call the validate method on the jQuery validate plugin it returns an instance of Validator which you should store. When you need to, you can call the form or showErrors methods on the Validator instance to either validate the form, or validate the form and show the errors respectively.

casperOne
Can you give me an example if possible please?