jQuery: The Write Less, Do More JavaScript Library

Alternate colors of a list (<ul> <li>)

View: New views
2 Messages — Rating Filter:   Alert me  

Alternate colors of a list (<ul> <li>)

by gjhames :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Alternate background-color of trs of a table is very easy with jquery, but, anyone knows how to alternate these colors of an list? <ul> <li>? I mean, alternate the colors of the <li>s of the list

Thanks!


Re: Alternate colors of a list (<ul> <li>)

by pedalpete-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


It should be the same.

[code]
$('li:even').addClass('even');
[/code]
I'm using it on divs, so it should work on li's as well.

On Sep 5, 1:02 pm, "Gewton Jhames" <gjha...@...> wrote:
> Alternate background-color of trs of a table is very easy with jquery, but,
> anyone knows how to alternate these colors of an list? <ul> <li>? I mean,
> alternate the colors of the <li>s of the list
>
> Thanks!
LightInTheBox - Buy quality products at wholesale price!