$(“#someDiv”)。attr(“scrollHeight”)在jquery-1.6.1中不起作用

时间:2011-05-31 23:52:29

标签: javascript jquery

$("#someDiv").attr("scrollHeight")适用于所有浏览器的jquery 1.3.2 。但是在更新到jquery 1.6.1 时,它只适用于IE9。 Firefox 4.0.1,Google Chrome 11和Safari 5都返回undefined。 $("#someDiv").get(0).scrollHeight但仍适用于所有浏览器。

有人知道发生了什么吗?在最新的jquery(即版本1.6.1)中 attr("scrollHeight") 被破坏了吗?

1 个答案:

答案 0 :(得分:38)

jQuery 1.6引入了.prop并改变了.attr的含义。

Read all about it.

(总是值得先查看文档; the page for .attr也会讨论这个问题。)