Select multiple ID's - Both checkboxes must be selected

前端 未结 7 894
猫巷女王i
猫巷女王i 2021-02-07 03:37

Is there a way for two or more ID\'s be required to be checked before doing something.

For instance:

If BOTH Checkbox 1 and Checkbox 2 are checked then th

7条回答
  •  情话喂你
    2021-02-07 03:58

    $('#checkbox1, #checkbox2').change(function() {
       if ($('#checkbox1').is(':checked') && $('#checkbox2').is(':checked')) {
           // Do some stuff if both boxes are checked...
       }
    });
    

提交回复
热议问题