Answers for "JavaScript count list items"

0

JavaScript count list items

var myUL = document.getElementById("myUL");
var list = myUL.children.tags("LI");
alert(list.length);
Posted by: Guest on April-20-2021
0

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]);
	}
}
Posted by: Guest on April-20-2021

Code answers related to "JavaScript count list items"

Code answers related to "Javascript"

Browse Popular Code Answers by Language