Uncaught TypeError: Cannot set property 'mobile' of undefined

非 Y 不嫁゛ 提交于 2019-12-13 11:39:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!