gpt4 book ai didi

javascript - 无法显示来自模型 mvc 的验证错误消息

转载 作者:太空宇宙 更新时间:2023-11-04 11:02:57 29 4
gpt4 key购买 nike

我的文件是这样排序的

 <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’属性”上收到此错误。当我提交按钮或加载页面时,此错误出现在控制台中

最佳答案

查看 jquery 验证的 bower 文件不显眼:https://github.com/aspnet/jquery-validation-unobtrusive/blob/master/bower.json

很明显,它依赖于 jquery.validate 脚本。所以你需要把它们放在你的 html 中的 jquery.validation.unobtrusive 之前,像这样:

 <script src="~/Content/js/jquery.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/jquery.validate.unobtrusive.js"></script>
<script src="~/Content/js/jquery.unobtrusive-ajax.min.js"></script>
<script src="~/Content/js/responsive-table-ul-main.js"></script>
<script src="~/Content/js/bootstrap.min.js"></script>

关于javascript - 无法显示来自模型 mvc 的验证错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34178313/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com