简体   繁体   中英

How can I get the text of the selected item from a dropdown using jQuery?

如何使用jQuery从下拉列表中获取所选项目的文本?

Using the following URL, I came up with this solution:

http://www.mail-archive.com/discuss@jquery.com/msg17717.html

$("#myDropdown option:selected").text()

Not sure if this is the best solution, but it seems to work great.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM