问题
{{ See demo }}
Page 1 is a jquery mobile page.
Page 2 is a page with jquery mobile tabs and navbar widget.
Page 3 is a page without jquery mobile tabs and navbar widget.
The only structural difference between 2 and 3 is the presence of data-role=tabs.
A) When each of them are run as is (you type the url on address bar), everything is fine.
B) When you click from page 1 to page 2,
i) js error: Uncaught SyntaxError: Unexpected token < VM10189 jquery-1.11.1.min.js:2
ii) the code outside <page/> on page 2 is run, as you see the alert.
C) When you click from page 1 to page 3, everything is fine (no js error, code outside <page/> not run).
What is wrong?
回答1:
Somebody gave an answer on the same question asked elsewhere. I checked it working. Look for
$.widget( "ui.tabs", $.ui.tabs, {
....
来源:https://stackoverflow.com/questions/27167311/js-error-when-a-linked-page-has-jquery-mobile-tabs-and-navbar-widget