lundi 23 octobre 2017

'Checkbox change' results in infinite loop

My requirement is to check/uncheck all other checkboxes on a checkbox change event But results in infinite loop.

  $(".chk").change(function (event) {
        var $this = $(this);
        var id = $this.attr('id');
        var chkOtherCheckboxes = 'on';
        if ($this.is(':checked')) {
            chkOtherCheckboxes = 'off';
        }
        $('input:checkbox:not("#' + id + '")').bootstrapToggle(chkOtherCheckboxes);
    });



Aucun commentaire:

Enregistrer un commentaire