When I'm trying to store all <a>
elements as objects in array (using $('a')
), and then get the position of each of them, it doesn't work.
years = $('a');
for(i=0;i< years.length;i++){
if(years[i].position().top > year.position().top){
}
else{
}
}
Console says:
Uncaught TypeError: Object file:///Users/.../index.html# has no method 'position'
When I do it with single element selected by class name instead of tag name, everything works fine.
What am I doing wrong ?