无法显示模型mvc的验证错误消息

时间:2015-12-09 12:00:19

标签: javascript c# jquery css

我的文件按此顺序

 <script src="~/Content/js/jquery.min.js"></script>
 <script src="~/Content/js/jquery.validate.unobtrusive.js"></script>
 <script src="~/Content/js/jquery.unobtrusive-ajax.min.js"></script>
 <script src="~/Content/js/jquery.validate.min.js"></script>
 <script src="~/Content/js/jquery.validate.mvc.js"></script>
 <script src="~/Content/js/responsive-table-ul-main.js"></script>
 <script src="~/Content/js/bootstrap.min.js"></script>

我在页面上收到此错误“无法设置属性'unobtrusive'未定义”。当我提交按钮或加载页面时,此错误将出现在控制台中

1 个答案:

答案 0 :(得分:1)

查看jquery验证的bower文件不引人注意:https://github.com/aspnet/jquery-validation-unobtrusive/blob/master/bower.json

很明显,它依赖于jquery.validate脚本。所以你需要在你的html中将它们放在jquery.validation.unobtrusive之前,如下所示:

    String inputPath = "stackjson* overflow";
    String newPath = inputPath.replaceAll("json*", "");
    System.out.println(newPath);