Try this:
<script>
$(document).ready(function(){
$('tr').each(function(){
$('td',$(this)).each(function(ind) {
$(this).addClass('something' + ind);
});
});
});
</script>
This way you first select all TRs (in all tables on the page, if you want to do it only in a specific table, add an id or class to that table) then using the each function select all TDs in that row then add a Class to every TD.
Fiddle: http://jsfiddle.net/cfjumovs/1/
0
solved jquery how to count divs in row with different class [closed]