jQuery Mobile入门错误 [英] jQuery Mobile getting started error
本文介绍了jQuery Mobile入门错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在遵循入门代码,
这是代码
<!DOCTYPE html>
<html>
<head>
<title>jQuery Mobile</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"/>
<link href="lib/jquery/jquery.mobile-1.3.2.css" rel="stylesheet" type="text/css" />
<script src="lib/jquery/jquery.mobile-1.3.2.js"></script>
<script src="lib/jquery/jquery-1.9.1.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>HOME</h1>
</div>
</div>
<div data-role="content">
<a href="02_menuform.html" data-role="button">MENU</a>
<a href="02_busform.html" data-role="button">BUS</a>
<a href="02_restaurantform.html" data-role="button">RESTAURANT</a>
</div>
</body>
</html>
但是我有这样的错误
Uncaught TypeError: Cannot set property 'mobile' of undefined jquery.mobile-1.3.2.js:26
(anonymous function) jquery.mobile-1.3.2.js:26
(anonymous function) jquery.mobile-1.3.2.js:27
(anonymous function) jquery.mobile-1.3.2.js:22
(anonymous function) jquery.mobile-1.3.2.js:24
并且它不应用jquery移动样式表(按钮和CSS类的东西)
and it doesn't apply the jquery mobile style sheet(button and css kind of stuff)
出什么问题了?
推荐答案
您需要将jquery放在移动js之前.
You need to place your jquery before mobile js.
替换
<script src="lib/jquery/jquery.mobile-1.3.2.js"></script>
<script src="lib/jquery/jquery-1.9.1.js"></script>
使用
<script src="lib/jquery/jquery-1.9.1.js"></script>
<script src="lib/jquery/jquery.mobile-1.3.2.js"></script>
此外,理想情况下,您的<div data-role="content">
应该是<div data-role="page">
的一部分.
Also, ideally your <div data-role="content">
should be part of the <div data-role="page">
.
这篇关于jQuery Mobile入门错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文