数据分析师2017-09-30 23:01:43
When a set of elements is obtained, why doesn’t it work like this? I remember there was a similar way of writing it before? ? -PHP Chinese website Q&A-When a set of elements is obtained, why can't it be written like this? I remember that there was a similar way of writing it before? ? -PHP Chinese website Q&A
Please watch and learn.
迷茫2016-12-20 09:36:04
$("li").each(function(index, element) { if (index % 2) { $(this).css('color','blue') } })
这里是2的倍数你可以用奇偶解决,可如果是3的倍数呢,如果,要按彩虹色呢,1,4,7红色,2,5,8蓝色,3,6,9黑色,或者别的,