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

前端 未结 30 1769
南方客
南方客 2020-11-21 15:58

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

30条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-21 16:21

    Try this:

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

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

    $("[id*='MyDropDownId'] :selected")
    

提交回复
热议问题