how to make an event happen when any of the checkboxes is checked or another when none is checked

0

I'm using if and else to make an element appear when any of the checkboxes is checked and disappears when none is checked and I'm using this method does not work

 $( 'intput' ).is( 'checked', true, function() {
  if ($(this).is()(':checked') ){
    setflag = ture;
    $('#scale-demo').removeClass('scale-out');
}
else if($("intput").is('checked') ) {
    $('#scale-demo').addClass('scale-out');
}
});
 I do not know exactly how to say that when any input is true, add the class and if none is checked, it disappears adding that class "scale-out"     
asked by John Kleinad 04.08.2018 в 22:45
source

1 answer

0

Be careful when you write, input - not intput; also true and not ture.

Try this.

$('input').on('click', function () {        
        if ($('input').is(':checked')) {
            setflag = true;
            $('#scale-demo').removeClass('scale-out');
        } else {
            $('#scale-demo').addClass('scale-out');
        }
    });
    
answered by 05.08.2018 в 00:29