You have to use
display style to handle it.
You cannot access invisible controls via javascript. Only those controls that are rendered on client site are available to javascript.
If a particular control is marked as
Visible=false
at server side, then that control is no more present in the HTML of the rendered page on client machine.
Though there is another way to handle such scenarios. If you need to hide a control but also want to access it in Javascript then play with
style:display
property.
Thus:
to
hide the control
document.getElementById("<%=lblToHide.ClientID%>").style.display = "none";
to
show the control
document.getElementById("<%=lblToHide.ClientID%>").style.display = "block";