Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js foreach class

const elements = document.querySelectorAll('.testimonial');
Array.from(elements).forEach((element, index) => {
  // conditional logic here.. access element
});

// -------------------------------------- OR

var testimonials = document.querySelectorAll('.testimonial');
Array.prototype.forEach.call(testimonials, function(element, index) {
  // conditional logic here.. access element
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #foreach #class
ADD COMMENT
Topic
Name
8+5 =