How to bind jQuery.validate.js verification to a dynamically added form
Can you help me a lot
给我你的怀抱2017-05-16 17:07:39
If you are using asp.net mvc and use jquery.validate.unobtrusive.js (asp.net mvc’s own validation, something that can be used in combination with class features)
Then you just add this js code before loading the page
//动态表单验证
$(document).ajaxComplete(function () {
$.validator.unobtrusive.parse(document);
});
PHPz2017-05-16 17:07:39
Is your form id predictable? If so, just write it in js:
$("#demoForm").validate();
That’s it. If even the ID is dynamically generated, just call the generated id directly in the view:
$("@ViewBag.FormId").validate();