📜  在 UL 中循环遍历 LI 元素 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:54.608000             🧑  作者: Mango

代码示例1
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 
  • element }