can't find jQuery's $ on asus tablet with android 3.2

喜欢而已 提交于 2020-01-17 07:45:11

问题


I wanted to test an app which I developed against API level 7 on our Asus tablet. Probably it won't look to nice or anything but I'd just like to see how it looks like. As external libraries we use jQuery, jQ mobile and Phonegap.

However the app won't even start:

ReferenceError: Can't find variable: $ at file:///android_asset/www/main.js:7

which is the following line:

$(function(event){//waiting for document

I'm totally blasted by this also because the app actually works on my 2.2 droid without any changes in the code. I appreciate any information related to this issue. :C


回答1:


Apparently the platform does not like to include external scripts like

<script type="text/javascript" charset="utf-8" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>

I had already downloaded the libraries and changing the source attribute to the local copy solved the problem.




回答2:


Just replace '$' with 'JQuery' :)




回答3:


I had this problem before. Most off the time a different library is imported (like prototype) . Simply replace the '$' for 'jQuery' see:

http://docs.jquery.com/Using_jQuery_with_Other_Libraries



来源:https://stackoverflow.com/questions/8487657/cant-find-jquerys-on-asus-tablet-with-android-3-2

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