我正在使用jQuery mobile multipage template,我想以編程方式打開第二頁。下面是我的示例HTML:jQuery Mobile:使用changePage方法時出現「Type Error」
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<meta charset="utf-8" />
</head>
<body>
<!--===========This is the first page==========-->
<div data-role="page" id="page1">
<div data-role="header" data-theme="e">
<h1>Dialog</h1>
</div>
<div data-role="content" data-theme="a">
<h1>This is page One</h1>
</div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
<!--========================================================-->
<!--===========This is the second page==========-->
<div data-role="page" id="page2">
<div data-role="header" data-theme="e">
<h1>Dialog</h1>
</div>
<div data-role="content" data-theme="a">
<h1>This is page Two</h1>
<
</div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
<script>
jQuery.mobile.changePage($("#page2"));
</script>
</body>
</html>
一切似乎都OK,但是當我打開這個網頁,我得到的螢火以下錯誤:
TypeError: u is undefined
我明白任何評論
你想打開它嗎?檢查這個答案http://stackoverflow.com/questions/16253300/removeclass-working-on-jsfiddle-but-not-in-the-browser/16253556#16253556 – Omar 2013-04-27 20:08:04