问题
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