Can't Enable button in JavaScript

<script type="text/javascript"> 
   function Enable_Butt() {               
         document.getElementById("<%=RadButton1.ClientID%>").disabled = false; // Doesn't Work                                                      
   }
</script>

i also tried this and still not work //$find(“<%=RadButton1.ClientID %>”).set_enabled(true);

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <ContentTemplate>
    <telerik:RadButton ID="RadButton1" runat="server"  SingleClick="true" SingleClickText="Processing..." AutoPostBack="true" OnClick="Create_Order_Click" Text="Create Order" Font-Bold="true" Font-Size="12" BackColor="#333333" ForeColor="White" Skin="Bootstrap" CssClass="auto-style5"  >
    </telerik:RadButton>
    <asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="5000" ></asp:Timer>
  </ContentTemplate>
  <Triggers>
    <asp:AsyncPostBackTrigger ControlID="RadButton8" EventName="Click" />
    <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
   </Triggers>
</asp:UpdatePanel>


protected void Timer1_Tick(object sender, EventArgs e){
     ScriptManager.RegisterStartupScript(Page, Page.GetType(), " ", "Enable_Butt()", true);
}

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Instead of setting the disabled attribute to false, just remove it:

function Enable_Butt() {
  document.getElementById("button").removeAttribute("disabled");
}

 document.getElementById("b").addEventListener("click", Enable_Butt)
<button disabled id="button">Button</button>
<button id="b">Enable</button>

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply