[英]Uncaught TypeError: $(…).tabs is not a function
I think there is a strange problem with jquery I got this exception when page load here is my markup : 我认为jquery有一个奇怪的问题,当这里的页面加载是我的标记时,我得到了这个异常:
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<link href="../Layouts/en-us/css/custom.css" rel="stylesheet" />
<link href="../Layouts/en-us/css/jquery-ui.css" rel="stylesheet" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="../ckeditor/ckeditor.js"></script>
<script src="../ckeditor/adapters/jquery.js"></script>
<script src="/Layouts/en-us/js/jquery-ui.min.js"></script>
</asp:Content>
here is the function that causes error 这是导致错误的函数
$(function () {
$("#tabs").tabs();
if ($("#ListBoxPages").val() == null) {
$("#tabs").css("display", "none");
}
$("#ListBoxPages").change(function () {
$("#tabs").css("display", "block");
});
});
All relative paths to Layouts and jquery were copied from another markup which works pretty fine with no error Layouts和jquery的所有相对路径都是从另一个标记复制而来的,该标记工作得非常好,没有错误
I can see that you are loading jquery twice so try to remove that 我可以看到你正在加载jquery两次,所以尝试删除它
<script src="/Layouts/en-us/js/jquery-ui.min.js" />
and keep only - 并保持 -
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" />
then use below code in place of your function (First check by changes in this function then try with removing that jquery-ui.min.js) 然后使用下面的代码代替你的函数(首先检查这个函数的变化,然后尝试删除那个jquery-ui.min.js)
$( document ).ready(function() {
$("#tabs").tabs();
if ($("#ListBoxPages").val() == null) {
$("#tabs").css("display", "none");
}
$("#ListBoxPages").change(function () {
$("#tabs").css("display", "block");
});
});
$("#tabs").tabs(); $( “#标签”)选项卡()。 requires Jquery.UI just include
需要Jquery.UI只包括
<script src="/Layouts/en-us/js/jquery-ui.min.js" />
or use CDN 或使用CDN
<scriptsrc="https://code.jquery.com/ui/1.12.1/jquery-ui.js"integrity="sha256-T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30="crossorigin="anonymous"></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.