samedi 9 septembre 2017

Checkbox checked only one from the grouup on click over div

I need to check checkbox on click over the div where checkbox resides inside that div. Now I need to check only one checkbox from the category. My code is working fine but its only work with checkbox change event not on div click.

<script>
$(':checkbox').on('change',
    function () {
        var th = $(this), id = th.prop('id');
        if (th.is(':checked')) {
            $(':checkbox[id="' + id + '"]').not($(this)).prop('checked', false);
            //console.log("a")
        }
    });




Aucun commentaire:

Enregistrer un commentaire