Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js for i in html collection

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
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #html #collection
ADD COMMENT
Topic
Name
4+8 =