来自:https://blog.csdn.net/xuaman/article/details/54631305
实例:
取值:
var array = new Array(); $(".horizontal_totle").find("input[type='checkbox']:checked").each(function () { array.push($(this).val());//向数组中添加元素 }); var animal_stage = array.join(',');//将数组元素连接起来以构建一个字符串 if (animal_stage == "") { layer.alert("请选择种群结构"); return false; }
同事赋值法:
<input type="checkbox" value="5" <c:if test="${fn:contains(dataAnimalBase.animalStage, '5')}">checked</c:if>>534435 <input type="checkbox" value="6" <c:if test="${fn:contains(dataAnimalBase.animalStage, '6')}">checked</c:if>>青年eet <input type="checkbox" value="7" <c:if test="${fn:contains(dataAnimalBase.animalStage, '7')}">checked</c:if>>zaz <input type="checkbox" value="8" <c:if test="${fn:contains(dataAnimalBase.animalStage, '8')}">checked</c:if>>121