Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

convert elements to array javascript

const images = document.querySelectorAll('img');
const imagesArray = Array.from(images);

// Create an array based on a property of the Elements e.g Classes.
const boxes = document.querySelectorAll('div.boxes');
const boxesClasses = Array.from(boxes, box => box.classList);
// This would create an array of the classes of all boxes
 
PREVIOUS NEXT
Tagged: #convert #elements #array #javascript
ADD COMMENT
Topic
Name
8+9 =