The JQuery .size() method returns the number of elements in an object. 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 })