var tab1 = $('.tabs a:first-child').attr('href');
alert(tab1);
.. matches only one although there are two div.switch on the same page. The second is down on the page, not in the same parent.
Edit: Basically my question is, :first-child should find all the elements, but it just stops after one like :first
1 Answer