【发布时间】:2009-02-05 14:36:28
【问题描述】:
以下 jquery 代码在 firefox 中有效,但在 IE 中返回 undefined:
$('someObject').attr("id")[0]
为什么会这样?
【问题讨论】:
标签: jquery
以下 jquery 代码在 firefox 中有效,但在 IE 中返回 undefined:
$('someObject').attr("id")[0]
为什么会这样?
【问题讨论】:
标签: jquery
试试
$('someObject').attr("id").charAt(0)
Internet Explorer 中的字符串不支持 [] 索引器运算符。 string::charAt() 是正确的使用方法。
【讨论】: