dimanche 7 août 2016

Array Checkbox validation in jquery

I want to validate an Array checkbox using Jquery, but i dont know how validate the checkbox using jquery... this is my code

<div class="col-sm-8">
  <label class="checkbox-inline"><input type='checkbox' name='checkboxvar[]' value='0' id='checkboxvar[]'>L</label>
  <label class="checkbox-inline"><input type='checkbox' name='checkboxvar[]' value='1' id='checkboxvar[]'>M</label>
  <label class="checkbox-inline"><input type='checkbox' name='checkboxvar[]' value='2' id='checkboxvar[]'>Mi</label>
  <label class="checkbox-inline"><input type='checkbox' name='checkboxvar[]' value='3' id='checkboxvar[]'>J</label>
  <label class="checkbox-inline"><input type='checkbox' name='checkboxvar[]' value='4' id='checkboxvar[]'>V</label>
</div>

<script>
 function validate() {
        if($("#checkboxvar").is(':checked')) {
            alert("actived");
        } else {
            alert("No actived");
        }
    }
</script>




Aucun commentaire:

Enregistrer un commentaire