Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to iterate over the DOM

// Note: This will only work in platforms that have
// implemented NodeList.prototype[Symbol.iterator]
const articleParagraphs = document.querySelectorAll('article > p');

for (const paragraph of articleParagraphs) {
  paragraph.classList.add('read');
}
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #How #iterate #DOM
ADD COMMENT
Topic
Name
2+8 =