开发者

Get all options in a select menu

开发者 https://www.devze.com 2023-01-11 22:20 出处:网络
开发者_JAVA技巧How do I get all the options (text,not the value) of a select menu by by specifying its idvar textArr = $(\"#mySelect\").map(function() {
开发者_JAVA技巧

How do I get all the options (text,not the value) of a select menu by by specifying its id


var textArr = $("#mySelect").map(function() {
    return $(this).text();
}).get();
alert(textArr);

Demo here. And see http://api.jquery.com/map/

0

精彩评论

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