我正在尝试对 ID 不是“第一”的所有 div 采取行动。但不知何故,当我运行每个循环时,它会忽略第一个 div 并继续下一个。我有一种感觉,这很容易解决......
jQuery:
$(document).ready(function(){
$.each($(".storyBlock:not(:first)"), function(i, object){
console.log(i); //returns 0 for the second item, 1 for the third item
});
});
HTML:
<div class="content">
<div class="storyBlock" id="second" style="margin-top:1500px" img="mypathhere"></div>
<div class="storyBlock" id="third" style="margin-top:1500px" img="mypathhere"></div>
<div class="storyBlock" id="fourth" style="margin-top:1500px" img="mypathhere"></div>
</div>