Click to See Complete Forum and Search --> : How to tell input from td?


Orsmo
08-30-2003, 12:12 AM
I'm writing a bit of javascript that updates the innerText of some td elements by totalling up the numbers in a list of named elements. The problem is that in the list, most of the elements are other td elements while a few are input (text) elements. As I loop my way through the list, how can I test the elements I've gotten with getElementByID to determine if they are td or input elements? I need this so I can either get their innerText or their value, respectively.

Fang
08-30-2003, 02:23 AM
document.getElementById("tagID").tagName

Orsmo
08-30-2003, 07:34 AM
Thank you very much. Hopefully I'lleventually get familiar enough with all this to stop asking such simple questions. ;-)

Fang
08-30-2003, 10:07 AM
Info on tagName (http://mozilla.org/docs/dom/domref/dom_el_ref29.html#1028258)