How to enable a linkbutton server control using javascript?
I have a linkbutton server control in my page whose Enabled attribute is initially set to "false". When a text box's text changes I would like to enable the linkbutton. I tried the following but it does not work. Could you let me know 开发者_StackOverflowif i am missing something.
function TextBox_TextChanged()
{
var control = $get("<%= linkButtonSave.ClientID%>");
if(control != null)
control.enabled = true;
}
Thanks
try
control.disabled = false;
You're dealing with HTML controls, not server side controls.
You will have to use an id selector. And remove the disabled attribute using .removeAttr()
. I assume you are using $get
as an alias name for $
.
$get("#<%= linkButtonSave.ClientID%>").removeAttr("disabled");
精彩评论