来自:https://blog.csdn.net/xuaman/article/details/54631305

checkbox 多选复选框取值问题

实例:

取值:

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

相关文章:

  • 2022-01-06
  • 2021-12-23
  • 2022-01-30
  • 2021-12-21
  • 2021-10-02
  • 2021-12-16
  • 2022-01-02
猜你喜欢
  • 2021-12-16
  • 2022-12-23
  • 2021-12-06
  • 2021-12-23
  • 2021-12-07
  • 2021-10-12
  • 2022-01-19
相关资源
相似解决方案