Answer the question
In order to leave comments, you need to log in
How to loop through all values in getElementsByClassname and find a string in them?
Hello.
Get a list of elements on a page
var elements = document.getElementsByClassName("txtBlock");
var countElements = elements.length;
for(i=0;i<countElements;i++){}
Answer the question
In order to leave comments, you need to log in
var elements = document.getElementsByClassName("txtBlock");
var countElements = elements.length;
for (let i = 0; i < countElements; ++i) {
console.log( elements[i] );
if (...) {
...
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question