Sunday, 15 September 2013

javascript - Replacing text in table with an array using Jquery -



javascript - Replacing text in table with an array using Jquery -

i'm using jquery v1.11.1 , want replace of td elements in html table 3rd row left. i'm using array values must passed in each td element of table.

var numberarray = [0,1,2,3,4,5]; $.each(numberarray , function(index, value){ $("table tr td:nth-child(3)").html(value); });

this returns in every td element 5. how can create 1, 2, 3, 4, 5 per td tag.

$("table tr td:nth-child(3)").each(function(index){ $(this).html(numberarray[index]); });

javascript jquery html

No comments:

Post a Comment