user1122844
user1122844

Reputation: 87

ReferenceError: $ is not defined jquery mobile

I know that this question is described and answered everywhere, although I can't find what my problem is. this is my code:

    <!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>

and script.js:

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

I know jquery needs to be loaded before script.js, which is the case here. I tried putting the code into the html, no use...

anyone who knows what the problem is here?

kind regards

Upvotes: 1

Views: 2922

Answers (1)

Michael Geary
Michael Geary

Reputation: 28860

You're not loading jQuery itself. You need to load jQuery before you load jQuery Mobile. jQuery Mobile is not jQuery and does not include jQuery.

jQuery Mobile is like jQuery UI: it's essentially a jQuery plugin, and you have to load jQuery before you can load a plugin.

Upvotes: 9

Related Questions