我似乎遇到了这个jquery代码的问题。
我想在第1个课程中添加一个课程,然后每6个
Here is the code:Query:
$('ul li:nth-child(5n+1)').addClass("red").text("Here");
Here is the css:
li { background-color:blue; }
.red{ background-color: red; }
答案 0 :(得分:7)
这应该适合你:
$('ul li:first, ul li:nth-child(6n)').addClass("red").text("Here");