javascript

Get selected option text using jQuery

The code can be used to get the text of the selected option using jQuery.

var selected_text = $("select option:selected").text();
console.log(selected_text);

$(document).on("change", "select", function() {
    var option_text = $('option:selected', this).text();
    console.log(option_text);
});
Was this helpful?