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

前端 未结 30 1697
南方客
南方客 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:14

    Various ways

    1. $("#myselect option:selected").text();
    
    2. $("#myselect :selected").text();
    
    3. $("#myselect").children(":selected").text();
    
    4. $("#myselect").find(":selected").text();
    

提交回复
热议问题