JavaScript Javascript disabled button if checkboxes are not choosen - problem javascript disabled button still clickable,javascript disabled button onclick,javascript

I wrote a code, that make the button not disabled when you check at least one checkbox with class "sum".

I want to change the code, so I have to classes for and you can check only one checkbox (or two of them) to make the button not disabled.

This is what I have and it works with only one class:

 var checkBoxes = $('.sum');
checkBoxes.change(function () {
    $('#dashboardbuttonpay').prop('disabled', checkBoxes.filter(':checked').length < 1);
});
$('.sum').change();

    });

This is what I tried to do, but OR op does not work:

 var checkBoxes = $('.sum' || **'.checkAll'**);
checkBoxes.change(function () {
    $('#dashboardbuttonpay').prop('disabled', checkBoxes.filter(':checked').length < 1);
});
$('.sum'  || **'.checkAll'**).change();

    });

The code works with && operator, but I do not need this.

Answer:1

Using the OR operation on strings this way does not make sense. If you do this with two non-empty strings, you always get the first operand:

console.log('a' || 'b')
Answer:2

I'm trying to use WebCola http://marvl.infotech.monash.edu/webcola/ but I can't find a link to the real documentation. The website seems to have only a few examples and some (apparently) auto-...

I'm trying to use WebCola http://marvl.infotech.monash.edu/webcola/ but I can't find a link to the real documentation. The website seems to have only a few examples and some (apparently) auto-...

I've created a simple JavaScript statement to open and close the nav side bar but it will only successfully open it and I'm confused as to why? if someone could explain it would be very helpful <...

I've created a simple JavaScript statement to open and close the nav side bar but it will only successfully open it and I'm confused as to why? if someone could explain it would be very helpful <...

  1. simple javascript statement
  2. simple javascript if statement
  3. simple switch statement javascript
  4. simple case statement javascript
  5. simple if else statement javascript

I am using ember-notify ember-notify in my ember-cli project. import { Component, inject } from 'ember'; export default Component.extend({ notify: inject.service('notify'), actions: { ...

I am using ember-notify ember-notify in my ember-cli project. import { Component, inject } from 'ember'; export default Component.extend({ notify: inject.service('notify'), actions: { ...

I am getting this error. I am trying to output names present in the array on the html document but I am not able to do it. I tried placing script tag below body but still not working. <!DOCTYPE ...

I am getting this error. I am trying to output names present in the array on the html document but I am not able to do it. I tried placing script tag below body but still not working. <!DOCTYPE ...