您的位置:首页 > 其它

input之checkbox用法

2015-06-10 11:52 411 查看
function getFids(){
fids="";
$('input[name="chBox"]:checked').each(function(){
fids+=$(this).val()+",";
});
fids=fids.substring(0,fids.length-1);
alert(fids);
}
function getAllFids(){
fids="";
if($('input[name="allBox"]').attr("checked")){//全选判定全选菜单是否选中
$('input[name="chBox"]').each(function(){
$(this).attr("checked",true);
//alert($(this).attr("checked"));
fids+=$(this).val()+",";
fids=fids.substring(0,fids.length-1);
});
}
else{
$('input[name="chBox"]').each(function(){//遍历所有name位chBox的复选框
$(this).attr("checked",false);
//alert($(this).attr("checked"));
fids="";
});
}
//fids=fids.substring(0,fids.length-1);
//alert(fids);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: