jQuery 屬性參考手冊
輸出 <li> 元素的數目:
$("button").click(function(){ alert($("li").length); });
親自試一試
length 屬性包含 jQuery 對象中元素的數目。
$(selector).length