Hello! Can you please tell me how to javascript without using jQuery to iterate over the HTML content inside the span depending on the number of blocks div class="column" ?
In other words: there is a variable var number = 'Один'; . It is necessary to compare it with the contents of the HTML block, and if there is a coincidence, then return the entire block with the exception of elements that have not slept with the template.
I take a cycle:
content = document.getElementsByClassName('column'); for(var i = 0; i < column.length; i++) { console.log(column.item(i)); } In this case, the loop runs twice. We get two <div class="column">...</div> objects that need to be iterated too. But how?
HTML code:
<div class="column"> <div class="category"> <div> <h3> <a href="#"> <span>Один</span> </a> </h3> <h3> <a href="#"> <span>Два</span> </a> </h3> <h3> <a href="#"> <span>Три</span> </a> </h3> </div> </div> </div> <div class="colum"> <div class="category"> <div> <h3> <a href="#"> <span>Четеры</span> </a> </h3> <h3> <a href="#"> <span>Один</span> </a> </h3> <h3> <a href="#"> <span>Шесть</span> </a> </h3> </div> </div> </div> Thank!
Ps masked var number = 'Один'; there should be an expression from two blocks (since both there and there the word "One" is present):
<div class="column"> <div class="category"> <div> <h3> <a href="#"> <span>Один</span> </a> </div> </div> </div> <div class="column"> <div class="category"> <div> <h3> <a href="#"> <span>Один</span> </a> </div> </div> </div>