jquery ul li length code example
Example 1: jquery count elements
var count_elements = $('.class').length;
Example 2: jquery li count in ul
$('#menu ul').filter(function(){ return $(this).children("li").length > 1 })
var count_elements = $('.class').length;
$('#menu ul').filter(function(){ return $(this).children("li").length > 1 })