Not logged in - Login

Disable LinkButton with Javascript

The following illustrates how to disable an ASP.Net LinkButton control via Javascript.

The code for the LinkButton:

<asp:LinkButton ID="btnSubmit" runat="server" 
   OnClick="btnSubmit_Click" 
   OnClientClick="return Submitting(this);">  
  Submit Button
</asp:LinkButton>

The javascript code to disable the button on the client side after a click event:

function Submitting(btn) {
   document.getElementById("<%= this.btnSubmit.ClientID %>").setAttribute("disabled", "true");
}