Pyt*_*ast 8 javascript jquery jquery-ui
我已经在SO上阅读了关于这个主题的线索,但是无法获得所需的o/p.他们说这个问题出现是因为有些js文件被多次包含在内.但我尝试逐个删除多个文件,但仍然得到TypeError: $(...).dialog is not a function错误.我在哪里包含多个js文件?有人可以指出来.谢谢.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script type="text/javascript" src="{% static "js/bootstrap.js" %}" ></script>
<script type="text/javascript" src="{% static "dashboard/js/jquery-ui-personalized-1.6rc2.min.js" %}" ></script>
<script type="text/javascript" src="{% static "dashboard/js/inettuts.js" %}" ></script>
<script type="text/javascript" src="{% static "dashboard/js/dashboard.js" %}" ></script>
Run Code Online (Sandbox Code Playgroud)
我得到的错误是: -
Error: Syntax error, unrecognized expression: #intro,
...nction(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"...
jquery.min.js (line 4)
TypeError: t.widget.extend is not a function
..."drag",e,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return thi...
jquery-ui.min.js (line 5)
Run Code Online (Sandbox Code Playgroud)
mel*_*cia 10
你有几个jQuery库被加载到同一个页面上(同一个东西的不同版本),这是错误的,除非你真的需要保持旧的插件工作依赖于以前的版本.在这种特定情况下,您需要解决冲突.
这就是你所需要的:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script type="text/javascript" src="{% static "js/bootstrap.js" %}" ></script>
<!-- Not so sure what is this, but certainly it's another jQuery UI library being loaded on top of the other one -->
<!-- <script type="text/javascript" src="{% static "dashboard/js/jquery-ui-personalized-1.6rc2.min.js" %}" ></script>-->
<script type="text/javascript" src="{% static "dashboard/js/inettuts.js" %}" ></script>
<script type="text/javascript" src="{% static "dashboard/js/dashboard.js" %}" ></script>
Run Code Online (Sandbox Code Playgroud)
在这里查看CSS样式表(使用主题):http://jqueryui.com/
jQuery UI对话框:http://jqueryui.com/dialog/
UPDATE
在我们聊聊评论之后,我发现你正在使用一个inettuts基于真实旧版本的jQuery和jQuery UI库(1.2.x)的插件.此外,它使用不包含dialog小部件的jQuery UI的自定义版本,因此是第一条错误消息.
您可以尝试调整插件以使用更新的版本(遵循其自己的网站上的评论)或解决冲突并在同一页面上使用两个库.
这取决于你.