jQuery length 属性

约 154 字 更新于 2026-11-18 5iyo.com

jQuery length 属性

实例

输出 <li> 元素的数目:

$("button").click(function(){
    alert($("li").length);
});


定义和用法

length 属性包含 jQuery 对象中元素的数目。


语法

$(selector).length