how to loop through ul li in javascript code example
Example: js loop ul
var ul = document.getElementById("foo");
var items = ul.getElementsByTagName("li");
for (var i = 0; i < items.length; ++i) {
// do something with items[i], which is a <li> element
}