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

Set combo box value

P: 4
how to set value to combo box values using javascript?

Thanks & regards
Naveen
Feb 23 '07 #1
Share this Question
Share on Google+
3 Replies

acoder
Expert Mod 15k+
P: 16,027
To set the value of combo box options, get the option object, e.g.
Expand|Select|Wrap|Line Numbers
  1. //selObj is the combo box object
  2. var opt = selObj.options[0];
  3. opt.value = "set your value";
Note the above example sets the value for the first option. Just change 0 for the other options.
Feb 23 '07 #2

acoder
Expert Mod 15k+
P: 16,027
Changed title.
Feb 23 '07 #3

dmjpro
100+
P: 2,476
to change the text ...

use text instead of value
Feb 24 '07 #4

Post your reply

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