jQuery 属性
输出 <li> 元素的数目:
$("button").click(function(){ alert($("li").length); });尝试一下一键复制
$("button").click(function(){ alert($("li").length); });
length 属性包含 jQuery 对象中元素的数目。
$(selector).length