开发者

Get selected value from dropdown with jQuery and title

开发者 https://www.devze.com 2023-01-06 18:45 出处:网络
To get the selected value from a dropdown with ID is easy: $(\"#ComboBox option:selected\").text() However I can\'t use ID and need to get it by title/a select element, how do I do that? I tried so

To get the selected value from a dropdown with ID is easy:

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

However I can't use ID and need to get it by title/a select element, how do I do that? I tried something like: var item_level = $('select:contains("Item Level")').text开发者_如何学C()

but wasn't very successfull.

Any ideas? Thanks in advance.


with your comment you can select the selected option only in

$("select[title=Item Level] option:selected").text();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号