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

Auto-populating SELECT fields

P: 1
Hello All,

I am trying to autopopulate a SELECT INPUT field using an onClick function.
I can change value (i think), but am wondering how i change the text that is between the OPTION tags?

document.forms.formname.selectname.????? = 'what i want it to change to'...

Many Thanks,
Jul 6 '09 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
You'll have to first access the correct option element:
Expand|Select|Wrap|Line Numbers
  1. sel.options[i].text
where 'sel' is the select object and 'i' is the 0-based index to the option.
Jul 6 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.