1

I have made a button disabled by adding class (.addclass) its still disabled but clickable. But if I made that button disabled by adding .attr then its working as expected. How can I make a button disabled and not clickable by using .addclass in jquery

$(this._eButton).addClass("disabled");
//this is allowing the button to click even button is disabled
$(this._eButton).attr("disabled", true);
//this works as expected
Devi
  • 31
  • 3
  • 1
    `addClass` is for CSS ... `attr()` (or `prop()`) is for element attributes (or properties). You may be able to add `pointer-events: none;` to your disabled CSS should then work as you want. – Paul T. Oct 20 '20 at 01:38
  • 1
    Does this answer your question? [Disable button in jQuery](https://stackoverflow.com/questions/15122526/disable-button-in-jquery) – Twisty Oct 20 '20 at 04:30
  • Events worked. Thanks – Devi Oct 21 '20 at 12:37

0 Answers0