document.getElementById('id') find out what type of element in javascript

K

Katie

Hi

I have a function which uses the document.getElementById('id') to
change attributes of form objects etc. Is there any way i can find out
if the element is a checkbox, textbox, radio button etc, because i want
to distinguish between them in my function

Thanks for ure time and help
:)
 
M

Matt Kruse

Katie said:
I have a function which uses the document.getElementById('id') to
change attributes of form objects etc. Is there any way i can find out
if the element is a checkbox, textbox, radio button etc, because i
want to distinguish between them in my function

Check the "type" property, and javascript docs for what values to expect.
 
R

Randy Webb

Katie said the following on 7/20/2006 3:54 PM:
Hi

I have a function which uses the document.getElementById('id') to
change attributes of form objects etc. Is there any way i can find out
if the element is a checkbox, textbox, radio button etc, because i want
to distinguish between them in my function

document.getElementById('someDumbIDInsteadOfTheFormsCollection').type
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top