Disable a button on click

后端 未结 9 1515
栀梦
栀梦 2020-12-31 07:04

I have a button control. Once the user clicks on it, the click event should fire and then the button should get disabled. How can I do this? I have the option to use JQuery

9条回答
  •  迷失自我
    2020-12-31 07:23

    // to disable
    this.setAttribute('disabled', true); 
    // to enable
    this.removeAttribute('disabled');
    

    this is a cross browser solution

提交回复
热议问题