I would like to set the value of all the cells of a table by iterating through them.
Ideally I would like to access a Html table like an array i.e. $(\"#tbl\")[row][col]=\
If you simply want to assign a value to all the cells try this:
$(document).ready(function () {
$("#tbl td").append("sdfasdf");
});
If you want to extract the cells as 2 dimensional array:
$(document).ready(function () {
var rowsNcells = $.map($("#tbl tr"),
function(el, ind){
var row = [];
$("td", el).each(function(){
row.push(el);
});
return row;
});
});
and then somewhere in the code.
$(rowNcells[1][2]).text("Something");