How do I get the text value of a selected option?
Select elements typically have two values that you want to access. First there's the value to be sent to the server, which is easy:
1
2
|
|
The second is the text value of the select. For example, using the following select box:
1
2
3
4
5
6
7
|
|
If you wanted to get the string "Mr" if the first option was selected (instead of just "1"), you would do that in the following way:
1
2
|
|