Maruf Hossain
Maruf Hossain

Reputation: 39

How to bind another function after using jquery validation plugin

I am using the jQquery validation plugin and I want to execute another function after validation based on the validation result.

$('#profileForm').validate({
    submitHandler: function() {},
    errorPlacement: function(error, element) {},
    success: function(label, element) {}

})

How to bind another function that will execute every time after validation?

Upvotes: 0

Views: 96

Answers (1)

philipp
philipp

Reputation: 16505

wouldn't

$('#profileForm').validate({
  submitHandler: function() {
    /** handle submit stuff **/
    callSomeFx();
  },
  …
});

just do that?

You could define another function like so:

function onSubmit(){}

and set this as »submitHandler« to the .validate() configuration.

Upvotes: 1

Related Questions