开发者

jQuery :nth-child selecting just one?

开发者 https://www.devze.com 2022-12-19 23:03 出处:网络
$(\'.mydiv ul li:nth-child(4)\').addClass(\"nth\"); There are atleast 8 li\'s 开发者_开发问答in there but it only selects 4th but not 8th?$(\'.mydiv ul li:nth-child(4n)\').addClass(\"nth\");
$('.mydiv ul li:nth-child(4)').addClass("nth");

There are atleast 8 li's 开发者_开发问答in there but it only selects 4th but not 8th?


$('.mydiv ul li:nth-child(4n)').addClass("nth");

pay attention to the 4n

0

精彩评论

暂无评论...
验证码 换一张
取 消