Following code produces nothing but an error. I wish to retrieve REL attribute values of each of the DIVs. No idea, why I can'y do it.
Error I see in console: Uncaught TypeError: Object # has no method 'getAttribute'
<div class="boxes">
<div rel="first" class="box">Box 1</div>
<div rel="second" class="box">Box 2</div>
<div rel="third" class="box">Box 3</div>
</div>
<script>
$(function(){
var i = 0;
var allDivs = document.getElementsByClassName('box');
var arr = [];
arr.push(allDivs);
setInterval(function(){
console.log(arr[i].getAttribute('rel'));
i++;
}, 1000);
});
</script>