How to add a ‘submitHandler’ function when using jQuery Unobtrusive Validation?

The unobtrusive library will attach the validator on all forms, so you have to replace the submitHandler this way:

$("form").data("validator").settings.submitHandler = function (form) { alert('submit'); form.submit(); };

Leave a Comment