jquery validate提示错误的方法:引用【
】,自定义方法扩展到【$.validator】中。
推荐:《jquery视频教程
》jquery validate提示错误的方法:
修改jquery.validate提示错误方法,将错误信息用弹出框提示<script src="@Url.Content("~/Scripts/jquery.validate.js")"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")"></script>
$.extend($.validator.defaults, { showErrors: function (errorMap, errorList) { var msg = ""; $.each(errorList, function (i, v) { msg += (v.message + "\r\n"); }); if (msg != "") alert(msg); } });
$.validator
经调试发现,自定义的方法并没有扩展到
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.js")"></script> <script type="text/javascript"> $.extend($.validator.defaults, { showErrors: function (errorMap, errorList) { var msg = ""; $.each(errorList, function (i, v) { msg += (v.message + "\r\n"); }); if (msg != "") alert(msg); } }); </script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")"></script>
相关免费学习推荐:JavaScript
(视频)
以上是jquery validate如何提示错误的详细内容。更多信息请关注PHP中文网其他相关文章!