Getting the text from a drop-down box
Posted
by Teifion
on Stack Overflow
See other posts from Stack Overflow
or by Teifion
Published on 2008-08-08T13:36:16Z
Indexed on
2010/05/29
10:52 UTC
Read the original article
Hit count: 214
This gets the value of whatever is selected in my dropdown menu.
document.getElementById('newSkill').value
I cannot however find out what property to go after for the text that's currently displayed by the drop down menu. I tried "text" then looked at W3Schools but that didn't have the answer, does anybody here know?
For those not sure, here's the HTML for a drop down box.
<select name="newSkill" id="newSkill">
<option value="1">A skill</option>
<option value="2">Another skill</option>
<option value="3">Yet another skill</option>
</select>
Thanks
© Stack Overflow or respective owner