When I try to save all <a> elements as objects in an array (using $('a') ) and then get the position of each of them, this will not work.
years = $('a'); for(i=0;i< years.length;i++){ if(years[i].position().top > year.position().top){ } else{ } }
The console says:
Uncaught TypeError: Object file: ///Users/.../index.html# does not have a 'position' method
When I do this with the only element selected by class name instead of tag name, everything works fine.
What am I doing wrong?
Michael
source share