js loop ul

Solutions on MaxInterview for js loop ul by the best coders in the world

showing results for - "js loop ul"
Fabio
26 Oct 2019
1var ul = document.getElementById("foo");
2var items = ul.getElementsByTagName("li");
3for (var i = 0; i < items.length; ++i) {
4  // do something with items[i], which is a <li> element
5}
6