📅  最后修改于: 2022-03-11 15:03:37.287000             🧑  作者: Mango
var list = document.getElementsByClassName("events");
for (let item of list) {
console.log(item.id);
}
// To include older browsers (including things like IE), this will work everywhere:
var list= document.getElementsByClassName("events");
for (var i = 0; i < list.length; i++) {
console.log(list[i].id); //second console output
}