Disable a button on click

后端 未结 9 1597
栀梦
栀梦 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:17

    When using the "this.disabled = true" method make sure you check if the page is valid before disabling the control if you have validators on the page. If validation fails you won't be able to re-enable the control without reloading the page.

    if (Page_IsValid) this.disabled = true;
    

提交回复
热议问题