源碼:
復(fù)制代碼 代碼如下:
jQuery(function($){
$("input[name='key']:checkbox").click(function(){
var ids = '';
var flag = 0;
$("#ids").attr("value",ids);
$("input[name='key']:checkbox").each(function(){
if (true == $(this).attr("checked")) {
ids += $(this).attr('value')+',';
flag += 1;
}
});
if(0 < flag) {
$("#ids").attr("value",ids);
return true;
}else {
alert('請至少選擇一項!');
return false;
}
});
});
復(fù)制代碼 代碼如下:
$("input[name='key']:checkbox").each(function(){
if (true == $(this).attr("checked")) {
ids += $(this).attr('value')+',';
}
});
新聞熱點
疑難解答
圖片精選