Question

Get selected text from a drop-down list (select box) using jQuery

How can I get the selected text (not the selected value) from a drop-down list in jQuery?

 2534  2380522  2534
1 Jan 1970

Solution

 4031
$("#yourdropdownid option:selected").text();
2009-10-29
rahul

Solution

 291

Try this:

$("#myselect :selected").text();

For an ASP.NET dropdown you can use the following selector:

$("[id*='MyDropDownId'] :selected")
2009-10-29
kgiannakakis

Solution

 238

The answers posted here, for example,

$('#yourdropdownid option:selected').text();

didn't work for me, but this did:

$('#yourdropdownid').find('option:selected').text();

It is possibly an older version of jQuery.

2012-03-19
JYX

Solution

 82

This works for me

$("#dropdownid").change(function() {
    alert($(this).find("option:selected").text());
});

If the element created dynamically

$(document).on("change", "#dropdownid", function() {
    alert($(this).find("option:selected").text());
});
2015-08-14
Prabhagaran

Solution

 69
$("option:selected", $("#TipoRecorde")).text()
2011-08-16
Rafael

Solution

 56

This works for me:

$('#yourdropdownid').find('option:selected').text();

jQuery version: 1.9.1

2013-09-25
Binita Bharati

Solution

 54

$("#DropDownID").val() will give the selected index value.

2011-11-14
Neeraj

Solution

 44

For the text of the selected item, use:

$('select[name="thegivenname"] option:selected').text();

For the value of the selected item, use:

$('select[name="thegivenname"] option:selected').val();
2013-01-24
Kamrul

Solution

 41

Use this

const select = document.getElementById("yourSelectId");

const selectedIndex = select.selectedIndex;
const selectedValue = select.value;
const selectedText = select.options[selectedIndex].text;   

Then you get your selected value and text inside selectedValue and selectedText.

2015-05-14
Mohammed Shaheen MK

Solution

 35

Various ways

1. $("#myselect option:selected").text();

2. $("#myselect :selected").text();

3. $("#myselect").children(":selected").text();

4. $("#myselect").find(":selected").text();
2014-08-03
MD SHAHIDUL ISLAM

Solution

 32
$("#dropdownID").change(function(){
  alert($('option:selected', $(this)).text());
});
2014-02-01
124

Solution

 31
var someName = "Test";

$("#<%= ddltest.ClientID %>").each(function () {
    $('option', this).each(function () {
        if ($(this).text().toLowerCase() == someName) {
            $(this).attr('selected', 'selected')
        };
    });
});

That will help you to get right direction. Above code is fully tested if you need further help let me know.

2010-10-07
Zarni

Solution

 20

For those who are using SharePoint lists and don't want to use the long generated id, this will work:

var e = $('select[title="IntenalFieldName"] option:selected').text();
2013-11-05
FAA

Solution

 20

This code worked for me.

$("#yourdropdownid").children("option").filter(":selected").text();
2020-02-13
Naveenbos

Solution

 17
 $("#selectID option:selected").text();

Instead of #selectID you can use any jQuery selector, like .selectClass using class.

As mentioned in the documentation here.

The :selected selector works for <option> elements. It does not work for checkboxes or radio inputs; use :checked for them.

.text() As per the documentation here.

Get the combined text contents of each element in the set of matched elements, including their descendants.

So you can take text from any HTML element using the .text() method.

Refer the documentation for a deeper explanation.

2014-01-30
Nikhil Agrawal

Solution

 16
$("select[id=yourDropdownid] option:selected").text()

This works fine

2013-04-23
Thangamani Palanisamy

Solution

 16
$("#dropdown").find(":selected").text();


$("#dropdown :selected").text();

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

$("#dropdown").children(":selected").text();
2019-12-17
shyamm

Solution

 14

Try:

$var = jQuery("#dropdownid option:selected").val();
   alert ($var);

Or to get the text of the option, use text():

$var = jQuery("#dropdownid option:selected").text();
   alert ($var);

More Info:

2017-03-09
Vishal Thakur

Solution

 14

Simply try the following code.

var text= $('#yourslectbox').find(":selected").text();

it returns the text of the selected option.

2018-11-13
Muddasir23

Solution

 13
$('#id').find('option:selected').text();
2015-04-11
Nikul

Solution

 13

Select Text and selected value on dropdown/select change event in jQuery

$("#yourdropdownid").change(function() {
    console.log($("option:selected", this).text()); //text
    console.log($(this).val()); //value
})
2015-11-19
Sandeep Shekhawat

Solution

 13

For getting selected value use

$('#dropDownId').val();

and for getting selected item text use this line:

$("#dropDownId option:selected").text();
2016-01-23
Mojtaba

Solution

 12
var e = document.getElementById("dropDownId");
var div = e.options[e.selectedIndex].text;
2017-01-04
Kalaivani M

Solution

 9

Use:

('#yourdropdownid').find(':selected').text();
2014-07-31
kishore

Solution

 8

the following worked for me:

$.trim($('#dropdownId option:selected').html())
2015-09-17
Mohammad Dayyan

Solution

 7

In sibling case

<a class="uibutton confirm addClient" href="javascript:void(0);">ADD Client</a>
<input type="text" placeholder="Enter client name" style="margin: 5px;float: right" class="clientsearch large" />
<select class="mychzn-select clientList">
  <option value="">Select Client name....</option>
  <option value="1">abc</option>
</select>


 /*jQuery*/
 $(this).siblings('select').children(':selected').text()
2014-12-05
vineet

Solution

 7

This work for me:

$("#city :selected").text();

I'm using jQuery 1.10.2

2015-07-09
Mhandzkie

Solution

 6

$(function () {
  alert('.val() = ' + $('#selectnumber').val() + '  AND  html() = ' + $('#selectnumber option:selected').html() + '  AND .text() = ' + $('#selectnumber option:selected').text());
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head runat="server">
    <title></title>

  </head>
  <body>
    <form id="form1" runat="server">
      <div>
        <select id="selectnumber">
          <option value="1">one</option>
          <option value="2">two</option>
          <option value="3">three</option>
          <option value="4">four</option>
        </select>

      </div>
    </form>
  </body>
</html>

Click to see OutPut Screen

2016-08-09
Bhanu Pratap

Solution

 6

Try

dropdown.selectedOptions[0].text

function read() {
  console.log( dropdown.selectedOptions[0].text );
}
<select id="dropdown">
  <option value="1">First</option>
  <option value="2">Second</option>
</select>
<button onclick="read()">read</button>

2020-01-17
Kamil Kiełczewski