【发布时间】:2011-04-06 07:06:36
【问题描述】:
我正在尝试使用 twitter api 的 phonegap 和 jquery 插件向我的 android 模拟器显示推文。
当我在浏览器中运行代码时,它工作正常,但是当我尝试在模拟器上运行它时,它在 ddms 控制台中显示一些参考错误......
这里是错误...
04-06 12:18:40.813: ERROR/Web Console(486): ReferenceError: Can't find variable: $ at file:///android_asset/www/index.html:32
这是我写的代码...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta charset="UTF-8" />
<title>Tweet! Put Twitter on your site with this simple, unobtrusive jQuery widget</title>
<link href="index.css" rel="stylesheet"/>
<link href="jquery.tweet.css" rel="stylesheet"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="jquery.tweet.js" charset="utf-8"></script>
<script>
$(function(){
alert("Hello . . .sms. .. . ");
$(".tweet").tweet({
join_text: "auto",
username: "VJAnusha",
avatar_size: 48,
count: 10,
auto_join_text_default: "we said,",
auto_join_text_ed: "we",
auto_join_text_ing: "we were",
auto_join_text_reply: "we replied",
auto_join_text_url: "we were checking out",
loading_text: "loading tweets..."
});
});
</script>
</head>
<body>
<div class='tweet query'></div>
<script type="text/javascript">
**$(function(){ $(".example").each(function(i, e){ eval($(e).text()); }); });**
</script>
</body>
</html>
我已经突出显示它向我显示错误的行...。 谢谢
【问题讨论】:
-
可能是因为您试图访问 DOM 中不存在的
example类而出现此错误。尝试放置一个现有的类。
标签: javascript android cordova