jQuery 类型错误 $.widget 不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15523904/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Type Error $.widget is not function
提问by user2083121
I am using two jqueryplugins one is for Auto complete combo box and another for i Toggle button.Problem is that when I am accessing these two plugins at a time $ widget is not function error is displaying,but if I am giving these plugins individually no errors are displaying.Can you guys help me on this?
我正在使用两个jquery插件,一个用于自动完成组合框,另一个用于 i Toggle 按钮。问题是当我一次访问这两个插件时 $ widget is not function 错误显示,但如果我单独提供这些插件没有错误显示。你们能帮我解决这个问题吗?
回答by Anonymous
You are including jQuery twice. This is the problem. Just avoid the second including:
您两次包含 jQuery。这就是问题。避免第二个,包括:
<link rel="stylesheet" href="../../../jquery/jquery-ui.css" />
<script src="../../../jquery/jquery-1.8.2.js"></script>
<script src="../../../jquery/jquery-ui.js"></script>
<link href="../js/jquery.ibutton.css" rel="stylesheet" />
<script src="../js/jquery.ibutton.js"></script>
回答by Jeevi
Try adding the latest versions of jQuery & jQuery UI.
尝试添加最新版本的 jQuery 和 jQuery UI。
http://code.jquery.com/jquery-1.9.1.js
http://code.jquery.com/jquery-1.9.1.js
http://code.jquery.com/ui/1.10.2/jquery-ui.js
http://code.jquery.com/ui/1.10.2/jquery-ui.js
Latest versions of jQuery will support latest version of jQuery UI, hence try taking the latest version of both jQuery and JQuery UI.
最新版本的 jQuery 将支持最新版本的 jQuery UI,因此请尝试同时使用最新版本的 jQuery 和 JQuery UI。
回答by Ambal Mani
Problem was in order of including scripts. At first I included file fith my widget and jquery-ui after. I changed order and the problem was resolved.
问题是包含脚本的顺序。起初,我在我的小部件和 jquery-ui 之后包含了文件。我改变了顺序,问题就解决了。