I'm creating a list dynamically and I need to be able to retrieve values from the table cells. The structure is:
<ul id="tester">
<li><div><table><tr><td></td><td id="samecellid">I WANT THIS TD VALUE..
<li><div><table><tr><td></td><td id="samecellid">I WANT THIS TD VALUE..
<li><div><table><tr><td></td><td id="samecellid">I WANT THIS TD VALUE..
Each list item has a table within it - this table only has one row, so the td id is unique within each list item but not within the list as a whole obviously.
The problem I have is I can't seem to get the value of the td cell. I have tried several ways, this is my latest and it doesn't work:
if (lengthoflist > 0) {
for (i=1; i<=lengthoflist; i++){
var ul = document.getElementById("tester");
var mya = ul.getElementsByTagName("li")[i];
var myb = mya.getElementsByTagName("div");
var myc = myb.getElementsByTagName("table");
var myd = myc.getElementsByTagName("tr");
var mye = myd.getElementById("samecellid");
var celldata = mye.innerHTML;
}
}