When I add the dynamic content to page with javascript or ajax, the validation doesn't work with new content at all. I solved the problem by 2 ways.
Solution 1: Parse only changed content$("#yourID").html(yourContent); // add html to your tag $.validator.unobtrusive.parse($("#yourID")); // this will parse validation for new contentSolution 2: Parse validation for form tag
$.removeData($('#YourFormID').get(0), 'validator'); // clear the validation of the form tag jQuery.validator.unobtrusive.parse('#YourFormID');
Post a Comment