gpt4 book ai didi

javascript - window.jQuery.ui 未定义

转载 作者:行者123 更新时间:2023-12-02 18:04:29 26 4
gpt4 key购买 nike

嗨,在我的网站中,我加载了所有 jquery javascript 和 css,但我写了 console.log(window.jQuery.ui);它返回未定义。我不知道为什么。

所以如果我写 $(".tooltip").tooltip();它说:TypeError:对象[对象对象]没有方法“工具提示”

我的代码如下所示:

<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<link href="css/epoch_styles.css" rel="stylesheet" type="text/css" />
<link href="css/jquery.selectbox.css" rel="stylesheet" type="text/css" />
<link href="css/OnlineRezervasyon.css" rel="stylesheet" type="text/css" />
<link href="css/jquery.ui.tooltip.min.css" rel="stylesheet" type="text/css" />

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="js/jquery.tooltip.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<script src="js/epoch_classes.js" type="text/javascript"></script>
<script src="js/jquery.validate.min.js" type="text/javascript"></script>
<script src="js/jquery.selectbox-0.2.js" type="text/javascript"></script>
<script src="js/script.js" type="text/javascript"></script>

最佳答案

控制台将始终返回未定义,因为 jQuery UI 扩展了 jquery 对象本身,它不会添加为 jQuery 对象的属性。这就是为什么你可以这样做:

$('a.button').button();

而不是:

$('a.button').ui.button();

此外,您还需要像这样交换以下行,以确保不会出现任何 jQuery UI 错误:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<script src="js/jquery.tooltip.js" type="text/javascript"></script>
<script src="js/epoch_classes.js" type="text/javascript"></script>
<script src="js/jquery.validate.min.js" type="text/javascript"></script>
<script src="js/jquery.selectbox-0.2.js" type="text/javascript"></script>
<script src="js/script.js" type="text/javascript"></script>

关于javascript - window.jQuery.ui 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20214226/

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