I have one table that has 2 row and 3 column. I want add 2 attribute to any td that detect place it. (these attributes are col & row that show column and row for any tds.)
this is my code :
<table id="tab">
<tr id="rows">
<td></td>
<td></td>
<td></td>
</tr>
<tr id="rows" style="top:50px">
<td></td>
<td></td>
<td></td>
</tr>
</table>
and I want use loop that add 2 attribute in it any level for any td and at last I want to get this code but I cannot do it:
<table id="tab">
<tr id="rows">
<td col="1" row="1"></td>
<td col="2" row="1"></td>
<td col="3" row="1"></td>
</tr>
<tr id="rows" style="top:50px">
<td col="1" row="2"></td>
<td col="2" row="2"></td>
<td col="3" row="2"></td>
</tr>
</table>
$(elem).attr('foo', 'bar')