[thelist] Identifying HTML Elements with javascript

Ben Glassman bglassman at gmail.com
Fri Jul 7 12:09:30 CDT 2006


Great. nodeName is exactly what I was looking for.

Thanks,

Ben

On 7/7/06, Christian Heilmann <codepo8 at gmail.com> wrote:
> > 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]") {
> >
> > }
>
> Loop through the DOM1 elements collection of the form and check for
> nodeName for each of them.
>
> Be aware that there is select-one and select-multiple.
>
> Or use getElementById and type.
>
> http://www.beginningjavascript.com/Chapter9/topList.js
>
>
> --
> Chris Heilmann
> Book: http://www.beginningjavascript.com
> Blog: http://www.wait-till-i.com
> Writing: http://icant.co.uk/
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>



More information about the thelist mailing list