0

所以我试图将我的移动网站的 jQuery 从 1.7.3 升级到 1.8 以上,但是当我这样做时,我得到了这个控制台错误:

[Error] Error: Syntax error, unrecognized expression: [data-role]=page              error (jquery-1.8.0.js, line 4512)
tokenize                                                                                  (jquery-1.8.0.js, line 4785)
compile                                                                                   (jquery-1.8.0.js, line 4883)
select                                                                                    (jquery-1.8.0.js, line 4973)
select                                                                                    (jquery-1.8.0.js, line 5083)
Sizzle                                                                                    (jquery-1.8.0.js, line 3912)
find                                                                                      (jquery.mobile-1.3.2.js, line 348)
matchesSelector                                                                           (jquery.mobile-1.3.2.js, line 358)
filter                                                                                    (jquery-1.8.0.js, line 5371)
is                                                                                        (jquery-1.8.0.js, line 5218)
dispatch                                                                                  (jquery-1.8.0.js, line 3027)
eventHandle                                                                               (jquery-1.8.0.js, line 2677)
trigger                                                                                   (jquery-1.8.0.js, line 2941)
(anonymous function)                                                                      (jquery-1.8.0.js, line 3607)
each                                                                                      (jquery-1.8.0.js, line 611)
each                                                                                      (jquery-1.8.0.js, line 241)
trigger                                                                                   (jquery-1.8.0.js, line 3606)
_trigger                                                                                  (jquery.mobile-1.3.2.js, line 835)
(anonymous function)                                                                      (jquery.mobile-1.3.2.js, line 4065)
fire                                                                                      (jquery-1.8.0.js, line 973)
add                                                                                       (jquery-1.8.0.js, line 1016)
transitionPages                                                                           (jquery.mobile-1.3.2.js, line 4058)
changePage                                                                                (jquery.mobile-1.3.2.js, line 4708)
initializePage                                                                            (jquery.mobile-1.3.2.js, line 11158)
(anonymous function)                                                                      (jquery.mobile-1.3.2.js, line 11192)
fire                                                                                      (jquery-1.8.0.js, line 973)
fireWith                                                                                  (jquery-1.8.0.js, line 1080)
ready                                                                                     (jquery-1.8.0.js, line 406)
DOMContentLoaded                                                                          (jquery-1.8.0.js, line 83)

这个错误的结果是我什么都做不了。我不能切换页面,而且 iScroll 也不起作用。

我不知道错误可能在我的代码中,因为我没有看到对 jQuery 库以外的任何其他内容的错误引用,所以我真的不知道该放什么代码。这不是我自己编写的代码。干杯:)

4

1 回答 1

0

It seems there is a misspelling in a selector, it should be [data-role=page] (please search for it in the source code).

While you're at it, be sure to upgrade to the latest jQuery supported by JQM 1.3.2:

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
于 2014-07-08T10:35:54.737 回答