Ребята, подскажите, как решить следующую задачу:
Есть набор dom элементов:
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/1.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/2.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/3.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/4.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/5.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item tns-slide-active" id="aniimated-thumbnials-item0" aria-hidden="false">
<img src="images/1.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item tns-slide-active" id="aniimated-thumbnials-item1" aria-hidden="false">
<img src="images/2.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item tns-slide-active" id="aniimated-thumbnials-item2" aria-hidden="false">
<img src="images/3.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" id="aniimated-thumbnials-item3" aria-hidden="true" tabindex="-1">
<img src="images/5.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" id="aniimated-thumbnials-item4" aria-hidden="true" tabindex="-1">
<img src="images/4.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/1.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/2.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/3.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/4.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/5.jpg">
</div>
Мне необходимо произвести фильтрацию. Я делаю следующим образом:
let images = document.querySelectorAll('.aniimated-thumbnials__img')
for (let i = 0; i < images.length; i++) {
if (images[i].getAttribute('aria-hidden') == 'true') {
if (images[i].getAttribute('id') == 'aniimated-thumbnials-item' + [i]) {
console.log(images[i])
}
}
}
в итоге я хочу получить:
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/1.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/2.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/3.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/4.jpg">
</div>
<div class="aniimated-thumbnials__img tns-item" aria-hidden="true" tabindex="-1">
<img src="images/5.jpg">
</div>
Подскажите, как решить данную задачу.