checkbox全選和反選

/*得到checkbox中所選擇的客戶Id */
function getSelectedIds(){
var customerArr = [];
if($("#allCheck").prop("checked")){
$("input[name='hobby']").each(function(){
/* var customerId = $(this).val();
cu stomerArr += customerId+",";*/
customerArr.push($(this).val());
});
}else{
$("input[name='hobby']").each(function(){
if( $(this).prop("checked")){
/* var customerId = $(this).val();
cus tomerArr += customerId+",";*/
customerArr.push($(this).val());
}
});
}
return customerArr.join(",");
}


<td><input type="checkbox" id="allCheck" name="allCheck" value="1">全選</td>


<td><input type="checkbox" name="selectCustomer" value="${qr.id}" ></td>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章