Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript count list items

var ul = document.getElementById("myul");
var liNodes = [];

for (var i = 0; i < ul.childNodes.length; i++) {
	if (ul.childNodes[i].nodeName == "LI") {
		liNodes.push(ul.childNodes[i]);
	}
}
Source by www.sitepoint.com #
 
PREVIOUS NEXT
Tagged: #JavaScript #count #list #items
ADD COMMENT
Topic
Name
8+6 =