jQuery

jQuery Get Selected Option Text Examples

If you wondering how to use jQuery to Get Selected Option Text, you have come to the right place. In this article, I am going to show you how to do just that with just 1 line of code.

How to Get Selected Option Text using jQuery – Examples

Let us say that you have a select dropdown menu with multiple options. Let’s give this dropdown an id of “my_select”. Let’s assume that one of the options is selected (it does not matter which one). In such a case, the following is the code:

Example 1: Using option:selected

$("#my_select option:selected").text();

Example 2: Using numeric value of the option

Let’s say that you know the value of specific option and want to get the text of that specific option. Let’s assume that the value of the option is “5” and you want to get it’s text. Here is how you can get it:

$("#my_select option[value='5']").text();

Example 3: Using non-numeric value of the option

If you have a non-numeric as the value for the options, then you may do the following to get it’s text:

$("#my_select option[value='some_value']").text();
That’s it!

Do you know of any other ways to use jQuery to Get Selected Option Text? Feel free to share by commenting below.

Share your thoughts, comment below now!

*

*