第1715行出现jQuery语法错误
我正在开发一个程序,我将jQuery的版本更新为2.0.3(1.7.2上的问题与此相同),现在我在控制台中看到一个错误:第1715行出现jQuery语法错误,jquery,twitter-bootstrap,Jquery,Twitter Bootstrap,我正在开发一个程序,我将jQuery的版本更新为2.0.3(1.7.2上的问题与此相同),现在我在控制台中看到一个错误: Uncaught Error: Syntax error, unrecognized expression: http://172.16.191.166/system/administrator jquery-2.0.3.js:1715 ot.error jquery-2.0.3.js:1715 gt jquery-2.0.3.js:2325 kt jquery-2.0.3.
Uncaught Error: Syntax error, unrecognized expression: http://172.16.191.166/system/administrator jquery-2.0.3.js:1715
ot.error jquery-2.0.3.js:1715
gt jquery-2.0.3.js:2325
kt jquery-2.0.3.js:2712
ot jquery-2.0.3.js:1154
x.fn.extend.find jquery-2.0.3.js:5158
x.fn.x.init jquery-2.0.3.js:168
x jquery-2.0.3.js:63
i bootstrap.min.js:6
(anonymous function) bootstrap.min.js:6
x.extend.each jquery-2.0.3.js:590
x.fn.x.each jquery-2.0.3.js:237
r bootstrap.min.js:6
x.event.dispatch jquery-2.0.3.js:4676
y.handle jquery-2.0.3.js:4360
这是我的消息来源
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type='text/javascript' src='http://172.16.191.166/system/administrator/template/admin/js/jquery-2.0.3.min.js'></script>
<script type="text/javascript" src="http://172.16.191.166/system/administrator/template/admin/js/jquery-ui.min.js"></script>
<script type='text/javascript' src="http://172.16.191.166/system/administrator/template/admin/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<ul class="nav">
<li class="dropdown">
<a href="" data-target="http://172.16.191.166/system/administrator" class="dropdown-toggle" data-toggle="dropdown">System</a>
</li>
<li class="dropdown">
<a href="" data-target="http://172.16.191.166/system/administrator" class="dropdown-toggle" data-toggle="dropdown">User</a>
</li>
</ul>
</div>
</div>
</div>
</body>
</html>
-
-
我已经将上面的HTML裁剪到我需要的最小值,这仍然会导致问题。我使用jQuery1.7.2和2.0.3、bootstrap2.3.2和3.0.3实现了它。我在谷歌上找不到任何东西可以给我任何线索来解释我为什么要点击这个按钮
谢谢我冒昧地猜测一下,Bootstrap没有正确地清理来自数据目标的选择器。由于属性中包含特殊字符,因此需要对其进行清理
粗略地看一下Bootstrap的源代码,似乎就是这样。我会用Bootstrap提交一个bug,看看他们是否同意,尽管他们可能会告诉您为他们转义属性中的特殊字符。您希望看到什么
数据目标=”http://172.16.191.166/system/administrator“class=”dropdown toggle“
要做什么?调试您自己的代码,并在该错误之前找到调用jQuery的行。因为我们无法访问http://172.16.191.166
,我们无法重现您的问题。请尝试使用未缩小的js版本,这将使您的生活更轻松。我想问题是他正在将数据目标设置为http://172.16.191.166/system/administrator
。我很确定这个属性不应该是URL。我不认为不遵循他们的示例就需要一个bug:)我删除了数据目标属性,所有这些似乎都正常工作。谢谢你的帮助