问题
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
Any suggestions?
Thanks in advance!
回答1:
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.
回答2:
@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!
回答3:
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.
来源:https://stackoverflow.com/questions/16186748/uncaught-typeerror-cannot-set-property-mobile-of-undefined