javascript - 引用错误 : $ is not defined jquery mobile

标签 javascript jquery-mobile

我知道这个问题到处都有描述和回答,虽然我找不到我的问题是什么。这是我的代码:

    <!doctype html>
<html>
    <head>
        <title>jQM Complex Demo</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <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/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> 
        <script src="script.js" type="text/javascript"></script>
        <!--<meta http-equiv="Content-Type" content="txt/html; charset=utf-8" />

        <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>    
        <script src="mobileJquery.js"></script>-->
    </head>
    <body>
        <div>
            <h1><a href="http://www.stronteb.eu">test application</a></h1>
            <p id="testparagraaf">test</p>
            <img src="stront.gif"/>
        </div>

        <!--<script src="script.js" type="text/javascript"></script>-->
    </body>
</html>

和 script.js:

$( document ).on('pageload', 'index.html', function(e){       
    alert('Pageload');
});

我知道jquery需要在script.js之前加载,这里就是这样。我试过将代码放入html中,没有用...

有人知道这里的问题是什么吗?

亲切的问候

最佳答案

您没有加载 jQuery 本身。您需要在加载 jQuery Mobile 之前加载 jQuery。 jQuery Mobile 不是 jQuery,也不包含 jQuery。

jQuery Mobile 就像 jQuery UI:它本质上是一个 jQuery 插件,您必须先加载 jQuery,然后才能加载插件。

关于javascript - 引用错误 : $ is not defined jquery mobile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19259202/

相关文章:

javascript - 如何在 Fluid URI ViewHelper 中使用 Javascript 变量作为参数

javascript - react 数组映射中的设置值不起作用

javascript - 如何为 Canvas 创建标尺工具?

html - 如何将此 CSS 转换为 webkit

redirect - jQuery Mobile 301 重定向问题

jquery - :Visited 未检测到 AJAX 链接

javascript - 将另一个类作为类的静态属性

javascript - ng-repeat 中的 AngularJS ng-option

jquery-mobile - 使用 jquery mobile 将按钮动态添加到 ListView 中

json - jquery:Ajax Json简单渲染