You must Sign In to post a response.
  • Category: JavaScript

    Linkbutton enable/disable is not working in IE11 and firefox

    I am enabling/disabling linkbuttons through javascript using below code

    var lkbtn=document.getElementById('MyLinkButton');
    lkbtn.enabled=false //for disabling

    lkbtn.enabled=true // for enabling

    this code is working until IE8 and not working for IE11 and Firefox.

    I tried several methods like

    nothing is working.

    I want to enable/disable through javascript/jquery only. How can achieve this new browsers?
    I want both disabling and enabling.
  • #765085
    Hi chinnari,
    Try this:
    document.getElementById("LinkButtonID").disabled = "disabled";
    document.getElementById("LinkButtonID").Attributes["disabled"] = "disabled";
    Or you can write javascript function onclick of Linkbutton as follows:
    function DisableLB(isDisable)
    var obj = document.getElementById("LinkButtonID");
    if (isDisable)
    var href = obj.getAttribute("href");
    if (href && href != "" && href != null)
    obj.setAttribute('href_new', href);
    obj.removeAttribute('href'); = "gray";
    obj.setAttribute('href', obj.attributes['href_new'].nodeValue); = "blue";
    <asp:LinkButton ID="LinkButtonID" Text="LB" runat="server" PostBackUrl="~/WebForm1.aspx" />
    <asp:Button ID="Enable" Text="Enable" runat="server" OnClientClick="javascript:return DisableLB(false);" />
    <asp:Button ID="Disable" Text="Disable" runat="server" OnClientClick="javascript:return DisableLB(true);" />
    Hope it helps.
    Shashikant Gurav

  • #765107
    .enabled not supported by javascript anymore, you need to use property 'disabled'
    see below JQuery snippet
    function Enable() {
    $("#btnSave").attr('disabled', false);
    function Disable() {
    $("#btnSave").attr('disabled', true);

    OR JavaScript
    use setAttribute() and removeAttribute()
    function disbtn(e) {
    if ( someCondition == true ) {
    } else {

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • Sign In to post your comments