给出代码:
var lastVisibleElement =$('#test > div:visible').last()[0];
为什么我必须使用 [0] 来获取我的 html. [0] 是做什么用的?
最佳答案
数组表示法[0]
用于获取对实际DOM元素而不是jQuery对象的引用。
$( "#foo" )[ 0 ]; // Equivalent to document.getElementById( "foo" )
关于jquery - 为什么我必须在 jQuery 查询后使用 [0],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28107017/