如何获取选中的checkbox的值
1个回答
展开全部
获取所有name为spCodeId的checkbox
var spCodesTemp = "";
$('input:checkbox[name=spCodeId]:checked').each(function(i){
if(0==i){
spCodesTemp = $(this).val();
}else{
spCodesTemp += (","+$(this).val());
}
});
$("#txt_spCodes").val(spCodesTemp);
var spCodesTemp = "";
$('input:checkbox[name=spCodeId]:checked').each(function(i){
if(0==i){
spCodesTemp = $(this).val();
}else{
spCodesTemp += (","+$(this).val());
}
});
$("#txt_spCodes").val(spCodesTemp);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询