checkbox

<div class="form-group">
<label class="col-sm-2 control-label">发布系统:</label>
<div class="col-sm-10">
<input type="hidden" id="fbxt" name="fbxt" value="${news.fbxt}">
<input type="checkbox" name="checkxt" id="checkbox-3-3" value="1" onclick="getCheck('fbxt')"/><label
for="checkbox-3-3"><span>触摸屏</span></label>
<input type="checkbox" name="checkxt" id="checkbox-3-4" value="2" onclick="getCheck('fbxt')"/><label
for="checkbox-3-4"><span>公众服务网</span></label>
<input type="checkbox" name="checkxt" id="checkbox-3-5" value="3" onclick="getCheck('fbxt')"/><label
for="checkbox-3-5"><span>androidAPP</span></label>
<input type="checkbox" name="checkxt" id="checkbox-3-6" value="4" onclick="getCheck('fbxt')"/><label
for="checkbox-3-6"><span>IOSapp</span></label>
</div>
</div>



<script>
function getCheck(fbxt) {
var str="";
$("input[name='checkxt']:checked").each(function () {
if(str == ""){
str+=$(this).val()
}else{
str+=","+$(this).val()
console.log(2222222)
}
})
console.log(str)

}
</script>
原文地址:https://www.cnblogs.com/libo199374/p/7942580.html