[thelist] Identifying HTML Elements with javascript

Ben Glassman bglassman at gmail.com
Fri Jul 7 11:25:53 CDT 2006


Hi all,

I'm working on a javascript form validation script and I am trying to
cycle through an array of html objects (in this case they are form
elements, inputs, selects, etc.) and I want to know what the best way
to get javascript to figure out exactly what type of object it is
dealing with so I can execute a different function to validate a text
field, select, radio, etc.

Currently I've got it to work (for checking if its a select object)
with the following if statement

if (elem == "[object HTMLSelectElement]") {

}

but I'm wondering if there is a better way

Thanks,

Ben



More information about the thelist mailing list