I have a submit() event attached to my form submit button, before I started using the jquery validation plug in I could submit this form on a single click. Now for some reas
This is your whole problem...
$("form").submit(function(){
$(".selector").validate({
...
You do not need to put .validate()
inside of a submit
event handler. The plugin already captures the submit
event automatically. The .validate()
method is the initialization method of the plugin on your form; it only gets attached to the form
element and then only called once on DOM ready. (You presently need to double-click because it takes the first click just to initialize the plugin.)
Just do this instead...
$(document).ready(function() {
("#yourform").validate({
// options & rules
});
});
Simple DEMO: http://jsfiddle.net/x6Ckg/
If, for whatever reason, you need to run other code on the submit
event, you would use the submitHandler
callback function provided by the plugin.
$(document).ready(function() {
("#yourform").validate({
//options & rules,
submitHandler: function (form) {
// stuff to do when form is valid
// ajax, etc?
}
});
});