By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,398 Members | 1,362 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,398 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
:)

Jul 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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('someDumbIDInsteadOfTheFor msCollection').type

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 20 '06 #2

P: n/a
Katie wrote:
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.

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Jul 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.