如何从jQuery的下拉列表中获取所选文本(而不是所选值)?


当前回答

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

这很好

其他回答

$(“#DropDownID”).val()将给出选定的索引值。

$("option:selected", $("#TipoRecorde")).text()

在jQuery中的下拉列表/选择更改事件上选择文本和所选值

$("#yourdropdownid").change(function() {
    console.log($("option:selected", this).text()); //text
    console.log($(this).val()); //value
})
$("select[id=yourDropdownid] option:selected").text()

这很好

以下内容对我有用:

$.trim($('#dropdownId option:selected').html())