I have implemented this to get value of checked checkboxes in array but dont know where i am wrong i am getting array empty
<input type="checkbox" value="-1" id="-1" /> OPD CONSULTANCY <br />
<input type="checkbox" value="-2" id="-2" /> DOCTOR VISIT <br />
<script>
function allcheckedData() {
var allVals = [];
var checkedVals = [];
$('#all input[type=checkbox]').each(function () {
allVals.push($(this).val());
});
$('#all :checked').each(function () {
checkedVals.push($(this).val());
})
}
</script>
Aucun commentaire:
Enregistrer un commentaire