本文介绍了无法在 JavaScript 中启用按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我也试过了,还是不行//$find("<%=RadButton1.ClientID %>").set_enabled(true);

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);
}

推荐答案

与其将 disabled 属性设置为 false,只需将其删除:

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>

这篇关于无法在 JavaScript 中启用按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 21:21