HTML 代码:
<form id="myform">
<input type='checkbox' name='foo[]' value='1'>
<input type='checkbox' name='foo[]' checked='true' value='2' >
<input type='checkbox' name='foo[]' value='3' >
<input type='checkbox' name='foo[]' checked='true' value='4' >
</form>
JS代码:
$('input[name=foo]:checked').each(function(i,el){
if(clusterVal == 'ALL')
{
/* what do I have to do here? */
}
array.push($(el).val());
});
如何通过在查询中使用值来选中/取消选中复选框