Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two button, i would like button two to be disabled until the user clicks on button one first. i tried th efunction below but the button is still enabled (its not working)

What I have tried:

<script type="text/javascript">
   function isclicked() {

        if (document.getElementById('<%=btnone.ClientID %>').clicked == true)
            document.getElementById('<%=btntwo.ClientID%>').disabled = false;
        else
            document.getElementById('<%=btntwo.ClientID%>').disabled = true;
    }

</script>


<asp:Button ID="btnone" runat="server" OnClick="btnone_Click" OnClientClick="isclicked()" Text="Extract File" Width="186px" style="height: 26px;float:left" />

<asp:Button ID="btntwo" runat="server" Text="Submit file" style="margin-left: 0px;float:right"  CausesValidation="False" Width="186px" OnClick="btntwo_Click" />
Posted
Updated 10-Jun-19 18:59pm

A button does not have a clicked property as far as I know. It has a click event.

You should start off with button two's initial state being disabled (enabled = false). Then enable it in button one's OnClick event
 
Share this answer
 
Comments
Member 14183767 7-Jun-19 8:15am    
Thank you!
CHill60 7-Jun-19 9:36am    
My pleasure!
onClick="this.disabled=true; this.value='Sending…';"
 
Share this answer
 
Comments
CHill60 11-Jun-19 3:40am    
This will disable the button that is clicked. Not what the OP wanted.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900