我需要获取当前使用jquery检查的所有复选框的值,我想我会把它全部放在一个数组中,但我遇到了麻烦那。任何人都可以指出我的写作方向。如何获取与jquery相同的类的多个复选框的值
这是我目前使用的。我试图将当前选中的所有值发送给我拥有的div。
function cityPopulate() {
var arr44 = new Array();
var cityNames22 = $("input[name=city_select[]]:checked").each(function(){arr44.push(this.value);});
$("#city_pop").append(cityNames22.val());
}
When I try the code above, it just gives me the value of the first checkbox I check only. Not all of the rest.
你可以发布你到目前为止的代码吗? – 2012-03-13 21:12:13
可能重复的问题:http://stackoverflow.com/questions/786142/how-to-retrieve-checkboxes-values-in-jquery – 2012-03-13 21:13:59