Reapply jQuery validate to a Form loaded via AJAX

Here is a quick snippet to apply jQuery validate to a form loaded via AJAX.

 

var form = $(“#youFormIdentifier”);
form.removeData(‘validator’);
form.removeData(‘unobtrusiveValidation’);
$.validator.unobtrusive.parse(form);

 

Then you can now check if it is valid via:

 

var isValid = form.valid();

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.