Results 1 to 6 of 6
Aug 13, 2007, 08:15 #1
- Join Date
- Aug 2002
- 0 Post(s)
- 0 Thread(s)
Display selected option's text from drop down menu and change when selection changes
I tried to do a search but the search system didn't seem to respond - perhaps the search string was too long, but this was quite a particular problem.
I have a drop down menu, say like this:
<select name="dropdown"> <option value="5">ABC 1111</option> <option value="7">BBC 25252</option> <option value="1">SDFSDF sSDFSDFS</option> </select>
Suppose, further down the page, I want to display which option was selected in that menu, so if the first option was selected, I want to display 'ABC 1111', the second 'BBC 25252' etc. and if that option changes, this text displayed also changes.
Furthermore, that dropdown menu is dynamically generated, server-side (PHP, MySQL). Thus, hardcoded JS isn't really what I'm looking for, but rather something that will directly take what is shown - if that's possible?
Finally, I want to ensure that when the page is initially loaded, some text still shows - when the page is loaded, the first option will already be selected (not because I put 'selected' in, but because there's no blank option).
Thank you in advance... hopefully there's a simple solution - I'm sure there must be, but alas I know nothing about JS!