Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

iterate over array of html elements

const imgs = document.querySelectorAll(".img");
    // You can't simply use imgs.forEach as it is not exactly an array. To fix that, first convert it to an array and then iterate.
	[...imgs].forEach(img => {
			console.log(img);
	});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #iterate #array #html #elements
ADD COMMENT
Topic
Name
9+6 =