How to get the selected
option's text from the Chosen select
?
So not just the .val()
but the option label/text
The only way that work for me, was doing something like this:
var options = $("#ddl option:selected");
var values = $.map(options, function (option) {
return option.text;
});
Where values is an array.
Hope that it helps...
//Below code return name of the drop downn
$('#availableRevisionBatch option:selected').text()
//Below code return value of the drop downn
$('#availableRevisionBatch option:selected').val()
You can simply use this to get the label.
$('.result-selected').html()
or
$('.options option:selected').html()
Used:
$("#list option[value='"+id+"']").text();
To retrieve the label
of the selected
value
$("#objId option :selected").text();
Above jQuery statement should do it for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With