I go through the collection of elements with a forEach or FOR loop and for some reason only outputs the attribute value of the first element and the rest null, although the elements themselves output normally
var sliders = document.querySelectorAll('.slide'); var count = 0; console.log(count); document.querySelector('.next').onclick = function() { count++; sliders.forEach(function(i) { console.log(i.getAttribute('num')); }); }; <div class="next">Click me</div> <div class="slide" num="0"></div> <div class="slide" num="1"></div> <div class="slide" num="2"></div>
if(){}- Aircountis not from this play at all - Air