jquery-archive / jquery-mobile

jQuery Mobile Framework
https://jquerymobile.com
Other
9.7k stars 2.41k forks source link

Cannot set property 'mobile' of undefined #8633

Closed IsibisiDev closed 5 years ago

IsibisiDev commented 5 years ago

I was starting a project with mobile jquery when I check the console and I see this error:

Uncaught TypeError: Cannot set property 'mobile' of undefined at jquery.mobile-1.4.5.js:26 at jquery.mobile-1.4.5.js:26 at jquery.mobile-1.4.5.js:22 at jquery.mobile-1.4.5.js:22

Demo: https://jsfiddle.net/0r8e7dL2/ Tested on Chrome 68 jQuery Mobile version: Latest (1.4.5) jQuery Version: Latest (3.3.1) Web Server: Apache 2.4

FritzTheBlitz commented 5 years ago

Hi, I don't think that jQuery 3.3.1 is supported to be used with mobil 1.4.5 1.4.5 supports jQuery 1.8 - 1.11 and 2.1 And you have to load jquery.js before jquery.mobile,js

IsibisiDev commented 5 years ago

In the JSFiddle page I did not take into account the order of the scripts, locally I have the same error (jquery loaded first).

FritzTheBlitz commented 5 years ago

please try jQuery 1.x

<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
IsibisiDev commented 5 years ago

image

Scripts used:

https://code.jquery.com/jquery-1.12.4.min.js https://code.jquery.com/jquery-migrate-1.4.1.js jquery.mobile-1.4.5.js

FritzTheBlitz commented 5 years ago

please have a look at the release date ...

https://blog.jquerymobile.com/2014/10/31/jquery-mobile-1-4-5-released/

IsibisiDev commented 5 years ago

Ok, solved. The problem was the jQuery version.