Reputation: 7800
This problem is driving me crazy. When I reference jQuery tags to a http adress like
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
the application works fine.But when I use this code ( calling jquery locally )
<link rel="stylesheet" href="css/jquery.mobile-1.1.1.min.css" />
<script src="js/jquery-1.7.1.min.js" ></script>
<script src="js/jquery.mobile-1.1.1.min.js" ></script>
the application did not work and chrome console gives me this error
Uncaught TypeError: Cannot read property 'event' of undefined
jquery.mobile-1.1.1.min.js:7
I am 100% sure that the files are accessible ( Ctrl + U to show the source and I open the files from my browser, they are there and accessible ) does anyone have the same problem and knows the solution ?
Upvotes: 0
Views: 2344
Reputation: 5
I had this same issue, and my code looked like this at first:
<script src="jquery.mobile.js"></script>
<script src="jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="jquery.mobile.css">
But I switched it around to this and it worked:
<script src="jquery.min.js"></script>
<script src="jquery.mobile.js"></script>
<link rel="stylesheet" type="text/css" href="jquery.mobile.css">
Thanks Z!
Upvotes: 0
Reputation: 7800
Simply the solution is to make a call to jquery mobile
AFTER jquery
,
When using CDN I called jquery before jquery mobile but locally I inverted the order .
As a consequence I get that error and that's quite clear because jquery is not loaded yet !
Upvotes: 1
Reputation: 22578
Are you sure that your local copy of jquery (core) is v1.6.4 or v1.7.1. You are specifically referencing that over the CDN but your markup for the local <script>
include does not make that clear. jQuery Mobile 1.1.1 is only compatible with these two versions of core.
Upvotes: 0