[jQuery] Re: JQuery - CSS - style unordered list

2009-12-15 Thread Scott Sauyet
On Dec 15, 2:13 pm, huntspointer2009 wrote: > I actually modified the code you provided for me a little to create > the desired effect: Yeah, there was a small mistake in that. This would probably work: $(this).find("li:nth-child(4n+2), li:nth-child(4n+3)").addClass ("color"); The diff

[jQuery] Re: JQuery - CSS - style unordered list

2009-12-15 Thread huntspointer2009
Thanks Scott, I actually modified the code you provided for me a little to create the desired effect: previous code: $("ul ").each(function() { $(this).find("li:nth-child(4n+2)", "li:nth-child(4n +3)").addClass("color"); }); modified code: $('ul').each(function() { $(this).find("l

[jQuery] Re: JQuery - CSS - style unordered list

2009-12-15 Thread Scott Sauyet
On Dec 15, 12:53 pm, huntspointer2009 wrote: > thanks Virgil, > Is there a way to create the same effect without specifying the ( eq: > (' ') exact location) or (the content that inside) the list item? > because I might be using up hundreds of unordered lists, > each with a variable number of ta

[jQuery] Re: JQuery - CSS - style unordered list

2009-12-15 Thread huntspointer2009
thanks Virgil, Is there a way to create the same effect without specifying the ( eq: (' ') exact location) or (the content that inside) the list item? because I might be using up hundreds of unordered lists, each with a variable number of tags? original code: jhbshsbjhs udjkdnchb dkdnjkndjk hbd

[jQuery] Re: JQuery - CSS - style unordered list

2009-12-15 Thread Virgil Spruit
If you want it to depend from the content you can combine 'filter' and 'contains' like so; $("li").filter(":contains('02'),:contains('03'),:contains ('06'),:contains('07')").addClass('color'); Or if its the position, iterate over the ul's and the 'eq' looks up the position for each li. $('ul').e

[jQuery] Re: JQuery - CSS - style unordered list

2009-12-15 Thread Virgil Spruit
If you want it to depend from the content you can combine 'filter' and 'contains' like so; $("li").filter(":contains('02'),:contains('03'),:contains ('06'),:contains('07')").addClass('color'); Or if its the position iterate over the ul's and the 'eq' looks up the position for each ul. $('ul').ea

[jQuery] Re: JQuery - CSS - style unordered list

2009-12-15 Thread Virgil Spruit
If you want it to depend from the content you can combine 'filter' and 'contains' like so; $("li").filter(":contains('02'),:contains('03'),:contains ('06'),:contains('07')").css('background-color','green'); Or if its the position iterate over the ul's and the 'eq' looks up the position for each u