用:gt(0)可以忽略第一个元素,从第二个元素开始遍历,例如下面的代码
$("div:gt(0)").css({"border":"1px solid blue", "margin":"10px"});
其中:gt(index)表示大于index的元素,其中index是基于0的索引。
用each遍历,代码如下:
$("div:gt(0)").each(function(i,v){
$(this).css({"background-color":"pink", "margin":"10px"});
});
$("div:gt(0)").each(function (i,dom){
});