没什么好讲的,上代码:
(function ($) {var defaultOptions = {validClass: 'has-success',errorClass: 'has-error',highlight: function (element, errorClass, validClass) {$(element).closest(".form-group").removeClass(validClass).addClass(errorClass);},unhighlight: function (element, errorClass, validClass) {$(element).closest(".form-group").removeClass(errorClass).addClass(validClass);}};$.validator.setDefaults(defaultOptions);if ($.validator.unobtrusive) {$.validator.unobtrusive.options = {errorClass: defaultOptions.errorClass,validClass: defaultOptions.validClass};}})(jQuery);
jQuery Validation Unobtrusive Native
https://johnnyreilly.github.io/jQuery.Validation.Unobtrusive.Native/Home/GettingStarted.html
如果觉得《Bootstrap整合ASP.NET MVC验证 jquery.validate.unobtrusive》对你有帮助,请点赞、收藏,并留下你的观点哦!