954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Change text in div based on select option

I have a simple JavaScript question. I want a drop down selection so that when you select a certain option is shows the value of the option in a div. So for example:

<select>
<option value="select-1">One</option>
<option value="select-2">Two</option>
<option value="select-3">Three</option>
</select>


So lets say that option one is selected, then in a div somewhere else on the page "select-1" (the value of option one) would show up in that div. Same thing with all the other options. I will have a bunch of these on one page.

Does anyone know how to do this? Thanks!

jonow
Junior Poster
104 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
 

well .. you can give your div's (or labels) id's, and triggered by the onchange of your selectbox, get that element (by the id) and set it's innerText, innerHTML,...

That should get you started, I guess.

stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: