jquery获取多选框的值

<input type="checkbox" name="delType" value="1" onclick="delType()"/>1<br>
<input type="checkbox" name="delType" value="2" onclick="delType()"/>2<br>
<input type="checkbox" name="delType" value="3" onclick="delType()"/>3<br>
<input type="checkbox" name="delType" value="4" onclick="delType()"/>4<br>
<input type="checkbox" name="delType" value="5" onclick="delType()"/>5<br>
<script src=\'#\'" //ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script>
   function delType(){
      var checks = jQuery('input:checkbox[name="delType"]:checked');
       var array = new Array();
       checks.each(function(){
          array.push(this.value);
       })
       var checkValue = array.toString();
       alert(checkValue);
   }
</script>

获取多选框的值,以","分割

你可能感兴趣的:(jquery,获取多选框的值)