How do you set the “Visible” property of a ASP.NET control from a Javascript function?

后端 未结 9 565
不知归路
不知归路 2021-01-17 09:49

Bascially I want to know the best way to hide/show an ASP.NET control from a Javascript function. I figured I would just access the control in Javascript using:

<         


        
9条回答
  •  有刺的猬
    2021-01-17 09:55

    You want to set the display style property to 'none' (to hide) or null to show.

       var theControl = document.getElementById("txtEditBox");
    
       theControl.style.display = 'none';
    
       theControl.style.display = null;
    

    Doing it the jQuery way:

       $('#txtEditBox').hide();
    
       $('#txtEditBox').show();
    

提交回复
热议问题