Rahul Prajapat

Rahul Prajapat

  • NA
  • 1.6k
  • 638k

Want to disabled asp:LinkButton by javascript function

Jul 25 2015 4:44 AM
I have a textbox and a linkbutton, i want that if textbox is empty then linkbutton disabled otherwise linkbutton enabled.
 
code are :
 
<input runat="server" type="text" id="txtName" onblur="CheckName('txtName','LinkButton1')" />
 
 <asp:LinkButton Enabled="false" ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">LinkButton</asp:LinkButton>
 
 
and javascript function are :
 
 function CheckName(txt,btn)
{
var Name1= document.getElementById(txt).value; 
if(Name1 != null)
{
 document.getElementById(btn).disabled = false;
}
else
document.getElementById(btnNext).disabled = true; 
}
 
 Please help.
Thanks in advance.

Answers (5)