I want to change text in table td from 1,1,1 to 1,2,3 with jQuery
But it not seem to work. what is wrong in my code?
This is my JavaScript function.
function reorder(targetId){
var i = 1;
jQuery.find(targetId).each(function(){
jQuery(this).attr("innerHTML", i);
i ++;
});
}
My html code.
<form>
<input type="button" onClick="reorder('#index');" value="test"/>
<table>
<tr><td id="index">1</td></tr>
<tr><td id="index">1</td></tr>
<tr><td id="index">1</td></tr>
</table>
</form>