开发者

How to enable a linkbutton server control using javascript?

开发者 https://www.devze.com 2022-12-11 18:47 出处:网络
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

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");
0

精彩评论

暂无评论...
验证码 换一张
取 消