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]="5"
This does not work.
$(document).ready(function() {
for (var row = 0; row < 3; row++) {
for (var col = 0; col < 3; col++) {
$("#tbl").children().children()[row].children()[col].append("sdfasdf");
}
}
});
This works but I dont know why!!!
- I dont understand $("#tbl").children().children() why the need for the 2nd children
- Why is the 3rd children not a function i.e. children() like the 1st 2.
Why is'nt innerHTML not a function i.e. innerHTML()
$(document).ready(function() { for (var row = 0; row < 3; row++) { for (var col = 0; col < 3; col++) { $("#tbl").children().children()[row].children[col].innerHTML = "H!"; } } });