i'm trying to use this function to uncheck a checkbox when another one is cheked:
<script>
$('input.unchecked').on('change', function() {
$('input.unchecked').not(this).prop('checked', false);
});
</script>
But does not works, because when you check another checkbox the table conte disappears.
This is the HTML code:
<form class="filter">
<input type="checkbox" id="checkboxID" class="unchecked"> EG
<input type="checkbox" id="checkbox1OG" class="unchecked"> 1.OG
<input type="checkbox" id="checkbox2OG" class="unchecked"> 2.OG
<input type="checkbox" id="checkbox3OG" class="unchecked"> 3.OG
</form>
And here where i want to use it:
Any ideas?
EDIT: Maybe this?
<script>
$("#checkboxID").change(function(){
$("#tableID tr.rowEG").toggle(!this.checked);
});
$("#checkbox1OG").change(function(){
$("#tableID tr.row1OG").toggle(!this.checked);
});
$("#checkbox2OG").change(function(){
$("#tableID tr.row2OG").toggle(!this.checked);
});
$("#checkbox3OG").change(function(){
$("#tableID tr.row3OG").toggle(!this.checked);
});
</script>
Aucun commentaire:
Enregistrer un commentaire