jQuery 属性リファレンスマニュアル
<li>要素の数を出力します:
$("button").click(function(){ alert($("li").length); });
実際に試してみてください
length 属性は jQuery オブジェクト内の要素の数を含んでいます。
$(selector.length