所以我有2类复选框。获取复选框值与JS
<input type="checkbox" name="foo" value="val1" />
<input type="checkbox" name="foo" value="val2" />
<input type="checkbox" name="bar" value="val1" />
<input type="checkbox" name="bar" value="val2" />
当复选框被选中我想运行一个jQuery函数将分配两个变量
var foo = //the values of the checked boxes with the foo name
var bar = //the values of the checked boxes with the bar name
因此,可以说只有第一个复选框被这里因为两者都检查FOO组中被选中在酒吧组里。该组值是如下
var foo = val1;
var bar = val1,val2;
什么是通过共享相同的名称/班看看,如果他们被检查,如果这样的价值添加到字符串的所有复选框进行搜索的最佳途径?
看到http://stackoverflow.com/questions/416752/select-values-of-checkbox-group-with-jquery – Fortega