jQuery Mobile 入门错误

标签 jquery 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 之类的东西)

问题是什么?

最佳答案

您需要将 jquery 放在移动 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"> 的一部分.

关于jQuery Mobile 入门错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19238849/

相关文章:

javascript - 从按键下拉列表中选择值

php - 使用 AJAX 提交表单不会 POST 到数据库

javascript - 为什么在滑动面板打开时标题文本会隐藏?

jQuery CSS ThemeRoller Mobile : Applying Theme A, B,C到不同页面

jQuery 移动列表功能不起作用

javascript - CSS背景图片突然消失

javascript - jQuery 数据表自定义排序和过滤

javascript - 在jquery中设置iframe的查询字符串值?

javascript - Document.Open() 不起作用

在执行上一条语句之前显示 Javascript 警告框