Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
	});
 
PREVIOUS NEXT
Tagged: #iterate #array #html #elements
ADD COMMENT
Topic
Name
2+4 =