Thanks (Bi Jing),
You offered the best solution, I tried using all of the code that was
offered, but the following code was the only one that it made it work:
$(li:even:odd, li:odd:odd).addClass(test_css);
I also like the fact that it's a minimal amount code, written in one
line.
Thanks to
try to use this function
script
function test(){
var ind = 0;
$('ul').find('li').each(function(){
if (ind == 2){
$(this).css('test_css');
ind = 0;
}else{
ind++;
}
});
}
/script
Gk___
Sent from Minsk, Belarus
2009/10/16 huntspointer2009
You have an unnecessary n in your code.
var test_css = {'background':'#000'};
$(ul li:nth-child(3n)).css(test_css);
should be
$(ul li:nth-child(3)).css(test_css);
Liam
huntspointer2009 wrote:
- Can someone please help me solve the following issue?
- How can I select and apply a
Please try this
$(ul
li).each(function(i){this.addClass(['','','test_css','test_css'][i%4])})
OR..you can try to use another one:
$(li:even:odd, li:odd:odd).addClass(test_css);
On Fri, Oct 16, 2009 at 3:07 PM, Evgeny Bobovik bobo...@gmail.com wrote:
try to use this function
script
4 matches
Mail list logo