I have had a problem in firefox (using 10.0.2) trying to use javascript to retrieve the rows in a table. The following work in Chrome and IE, but not in firefox.
var tbl = "myTable";
var allTR;
allTR = document.getElementById(tbl).childNodes[0].childNodes;
var table = document.getElementById(tbl);
var tbody = table.getElementsByTagName("tbody")[0];
allTR = tbody.getElementsByTagName("tr");
allTR = tbody.children;
allTR = tbody.childNodes;
allTR = $("#myTable").find("tbody").find("tr");
allTR = $('#myTable tobdy tr');
In Firefox, the resulting allTR object shows up in Firebug as “undefined” even though I can see that it has a length property.
Does anyone know why this would happen?
if you want all the rows in a table:
if you want the rows in the first tbody: