Arcayne
Arcayne

Reputation: 1186

Uncaught TypeError: Cannot set property 'mobile' of undefined

I am developing an app with angular js and phonegap.

I am using jquery mobile in a directive, it is for adding some animation to a notification bar. I t works well with jquery 1.8.1 but when I use jquery mobile

<script src="scripts/vendor/jquery/jquery.mobile-1.3.1.js"></script>

I get the following error:

Uncaught TypeError: Cannot set property 'mobile' of undefined jquery.mobile-1.3.1.js:26

(anonymous function) jquery.mobile-1.3.1.js:26
(anonymous function) jquery.mobile-1.3.1.js:27
(anonymous function) jquery.mobile-1.3.1.js:22
(anonymous function) jquery.mobile-1.3.1.js:24

enter image description here

Any suggestions?

Thanks in advance!

Upvotes: 19

Views: 34986

Answers (3)

Ivan
Ivan

Reputation: 15952

Include first Jquery, then Jquery-mobile, like this:

    <script src="js/libs/jquery/jquery.js" type="text/javascript"></script>
    <script src="js/libs/jquery-mobile/jquery.mobile.js" type="text/javascript"></script>

Also, as others stated, use a jquery version 1.9.1 or higher.

Upvotes: 2

Omar
Omar

Reputation: 31732

With jQuery-Mobile version 1.3.1, use jQuery version 1.8.3 or higher. It's recommended to use jQuery version 1.9.1.

Upvotes: 23

Arcayne
Arcayne

Reputation: 1186

@Omar actually you made me fix that by your comment, I left commented out:

<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>

Thanks!

Upvotes: 6

Related Questions