Hi Shawn ... Can not get this going ...
$("#veh_odometer").children("tr").each( function () { Is "tr" another id that I have to specify within my HTML table? On Oct 31, 5:45 pm, Shawn <[EMAIL PROTECTED]> wrote: > I *think* the following will get you started: > > $("#veh_odometer").children("tr").each( function () { > //'this' refers to the current tr > var address = $("td:eq(2)", this).text(); > console.log("VALUE: " + address); > // note: console.log works in Firefox. > // Substitue an alert if desired > > // . . . Other processing here . . . > > }); > > Two points here though: > > - The $("#veh_odometer").children("tr") bit can be done in a few different > ways. But this should work (unless the the tbody element is needed too...). > For instance you can say $("#veh_odometer > tbody > tr").each() for > effectively the same results.... experiement for the method that works best > for you. > > - the var address line. We are using a "context" reference here - we are > saying give me the third TD in the context of the current row (this). Again, > more than one way to do this... $(this).children("td:eq(2)") would do the > same ( I think ). > > Anyways, hope that helps. > > Shawn > > On Thursday 30 October 2008 23:29:52 GrootBaas wrote: > > > Hi all, > > > Any help would really be much appreciated. > > > I have a table, how can I read the cellvaluesof the table ... > > > Currently I have ... > > > function test () { > > > var address; > > var i; > > > for (i=1; > > i<document.getElementById('veh_odometer').rows.length; i++) > > { > > > address = > > document.getElementById('veh_odometer').rows[i].cells[2].data; > > alert('VALUE: '+address) > > } > > > } > > > I do loop through the table, but my variable address is undefined. > > Any ideas?