title: Disabled button onclick event fires
body: <p>I have a button on a page, which is disabled if none of the check boxes is selected
  <a href="https://i.stack.imgur.com/EjYdm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EjYdm.png" alt="enter image description here"></a></p>
  
  <p>If a checkbox is selected the button became enabled. This is working fine, but the on click event is still fires, even if the button is enabled.</p>
  
  <p>This is the code when I click on a checkbox</p>
  
  <pre><code> $(document).on('click', '.damageCheckbox', function () {
  
      //$("#btnDamageInvoiceShow").removeClass("disabled");
  
      var idSelector = function () { return this.id; };
      var selectedDamages = $(":checkbox:checked").map(idSelector).get();
  
      if (selectedDamages.length &gt; 0)
      {
          $("#btnDamageInvoiceShow").removeClass("disabled");
          $('#btnDamageInvoiceShow').prop("disabled", false);
      }
      else {
          $("#btnDamageInvoiceShow").addClass("disabled");
          $('#btnDamageInvoiceShow').prop("disabled", true);
      }
      console.log(selectedDamages);
      ..... 
  </code></pre>
  
  <p>and this is the javascript when I press the button:</p>
  
  <pre><code> $("body").on("click", ".btnDamageInvoiceShow", function (e) {
  
              var idSelector = function () { return this.id; };
              var selectedDamages = $(":checkbox:checked").map(idSelector).get();
              console.log(selectedDamages);
  
              var baseUrl = '@Url.Action("ShowDamageInvoice", "TimberMonitor", new { Area = "" })';
              var url = baseUrl + '?' + $.param({ damageIds: selectedDamages }, true);
              location.href = url;
   });
  </code></pre>
  
  <p>I have try to resolve the problem by adding:</p>
  
  <pre><code>$('#btnDamageInvoiceShow').prop("disabled", false);
  </code></pre>
  
  <p>I have tried this way:</p>
  
  <pre><code>$("body").on("click", ".btnDamageInvoiceShow:disabled", function (e) {
  </code></pre>
  
  <p>but this way the button onclick event never fires.</p>