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:


The second is the text value of the select. For example, using the following select box:


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:


Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *