JavaScript / DOM question
July 8, 2004 9:18 AM
Subscribe
I'm learning JavaScript for a project, and having trouble sussing the DOM addresses of components of a page. I've played with FireFox's DOM Explorer, but while it shows the tree, it doesn't show the element addresses, nor can you print the tree out. Any suggestions?
Specifically, I've got a table that contains form fields, and when the user fills the second field on the last (current) row, I want to add a row and its attached fields (incrementing the number at the end of the fieldname by 1 for each new row).
I can see how to do most of it, but I can't quite figure out how to navigate the tree to the last row of the table so that I can do the paste -- or more accurately, I can figure out how to *do* it, but not where to *go*.
Is there a better/newer/more powerful DOM explorer type tool around somewhere that I'm missing?
I have the O'Reilly book; that's how I got this far...
posted by baylink to computers & internet (5 comments total)
Here are some things to keep in mind when navigating around a table:
tbodyelement, meaning your rows are children of thetbodyand not thetable.tbodyelement, lest your browser mysteriously ignore your new table.nextSiblingand the like, you have to watch out for text nodes in the DOM tree, particularly empty ones containing only whitespace.posted by Khalad at 9:46 AM on July 8, 2004