Javascript : Disable buttone
-
Hi, I am building a ASP.NET page using c#. I need a code to add a javascript function to disable a button on a text change event. The below is the code i wrote The script code in tags: function SetButtonStatus() { document.getElementById("Button2").disabled = true; } other codes here this is the textbox tag: It doesn't seem to work. Please help me on this one. I tried this in ASP.Net forums there were no replies
-
Hi, I am building a ASP.NET page using c#. I need a code to add a javascript function to disable a button on a text change event. The below is the code i wrote The script code in tags: function SetButtonStatus() { document.getElementById("Button2").disabled = true; } other codes here this is the textbox tag: It doesn't seem to work. Please help me on this one. I tried this in ASP.Net forums there were no replies
I would suggest just doing it in your code behind. This is a bit of c# code that works. On the aspx page : in the code behind protected void TextBox1_TextChanged(object sender, EventArgs e) { Button1.Enabled = false; } Now take note to the field AutoPostBack="true" this will update the button automatically after you click out of the textbox itself, which will cause the page to update. If you want to manually update the page you can just remove that line. Hope that helps
Matthew Vass QA Analyst mvass@hostmysite.com HostMySite.com
-
Hi, I am building a ASP.NET page using c#. I need a code to add a javascript function to disable a button on a text change event. The below is the code i wrote The script code in tags: function SetButtonStatus() { document.getElementById("Button2").disabled = true; } other codes here this is the textbox tag: It doesn't seem to work. Please help me on this one. I tried this in ASP.Net forums there were no replies