tags:

views:

13

answers:

1

Using the jquery-tmpl, I want to stripe presentation of the rows by adding a class to every second one, so from data ['Cat','Dog','Horse','Noddy'] it generates:

<li>Cat</li>
<li class="odd">Dog</li>
<li>Horse</li>
<li class="odd">Noddy</li>

The solutions suggested here looked like the start of something that could be further refined for easy digestion by us noddy's.

+1  A: 

Never mind. Overcomplicating things as usual...

Just follow it up with the :odd selector with addClass...

$('#template').tmpl(data).appendTo('#list')
$("#list li:odd").addClass('odd')
John Mee