将值传递为数组/集合

时间:2010-08-09 12:27:46

标签: javascript jquery

我有这段代码:

var addNew = $('#divListBox').find(':checked')
                     .map(function() {
                         return $(this).val();
                     }).get();

我想知道是否有办法获取所有已检查的值并将它们放入集合中,以便将其发送给我的控制器?

1 个答案:

答案 0 :(得分:1)

你可以这样做......

var v_coll=[];
$('#divListBox').find(':checked').each(function(){
   v_coll.push($(this).val);
});