不要问为什么,但我需要将类斑马添加到<li>
元素旁边,内容旁边。这是据我所知,但我不确定要使用什么计算:
$("li").each(function(index){
if(index % ??? == 0) { // <-- not sure what to put here
}
});
<ul>
<li></li>
<li></li>
<li></li> <!-- add the zebra class here -->
<li></li>
<li></li>
<li></li>
<li></li> <!-- add the zebra class here -->
<li></li>
<li></li>
<li></li>
<li></li> <!-- add the zebra class here -->
<li></li>
</ul>
任何人都可以帮忙吗?