Jump to content

select and object


cve60069
 Share

Recommended Posts

Hello I am trying to dynamically alter the contents of a drop-down menu. For example: <select id="contents><option>item 1</option><option>item 2</option><option>item 3</option></select> I want to change the value of each of the options from within a script. I am assuming I will use something like document.getElementById("contents").innerHTML=x, where x is a line of text; but I do not how to access the contents of each <option> Am I on the right track, please? Regards

Link to comment
Share on other sites

Guest So Called
I want to change the value of each of the options from within a script.
Why not this? It may not be elegant but it seems to solve the problem of getting each option separately. <select><option id="item1">item 1</option><option id="item2">item 2</option><option id="item3">item 3</option></select> Edited by So Called
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...