jQuery selectors return an array so we can use the length property. var num = $("#menu li").length; Alternatively we can use the size() method which returns the same value. var num = $("#menu li").size();
jQuery selectors return an array so we can use the length property. var num = $("#menu li").length; Alternatively we can use the size() method which returns the same value. var num = $("#menu li").size();