vendredi 24 mars 2023

how to capture when a checked checkbox becomes unchecked

I want to get the value of the checkbox that goes from being checked to unchecked.

<input type="checkbox" class="cbx" name="privilegiosG[]" id="privilegioG_<?= $privilegio->getId() ?>" value="<?= $privilegio->getId() ?>" <?= $checked; ?> />

tried this but it doesn't work for me

<script type="text/javascript>"

    $("input[name='seccionesG'] input:checkbox").change(function() {
    var ischecked= $(this).is(":checked");
    if(!ischecked)
        alert("uncheckd " + $(this).val());
    });

</script>



Aucun commentaire:

Enregistrer un commentaire