When I receive a comma-separated list of items from a database and insert them into a table cell, I want to apply alternating styles to make it easier for users to distinguish between them.
For example:
foo, bar, mon, key, base, ball
I'm looking to modify the code to achieve something like this:
<td class="wide">foo, <span class="alt">bar</span>, mon, <span class="alt">key</span>, base, <span class="alt">ball</span></td>
Therefore, I am searching for a way to add a span class to every other value using jQuery. Is there a simple solution for this?