【发布时间】:2011-05-17 23:10:15
【问题描述】:
在调试一些无法在 IE 中运行的 jQuery 时,我发现了以下错误消息:
var item = $("#item_"+ itemArray[itemIndex]).find('a').text().trim();
Object doesn't support this property or method (script.js, line 100, character 2)
character 2 对我来说没有意义。根据显示的文本,character 2 将是 var 中的字母 a,但这当然没有任何意义。
(我不应该使用var吗?)
我知道 jQuery 在某种程度上是有效的,否则该脚本将无法在我的页面上达到这一点。
【问题讨论】:
-
为什么?因为它是 Internet Explorer。
-
这个之前有人问过:stackoverflow.com/questions/2308134/… 基本上IE好像没有
trim()内置。 -
@Stephen - 这是一个非 jQuery 问题,最佳答案不同。
标签: javascript jquery internet-explorer