I have an ASP element. It was hidden in the aspx.cs page as such:
item.Visible = false;
After this is done, based on an event which I use JavaScript, I have to unhide this item.
The problem is that I cannot find this item on the DOM because it's hidden so I can't use document.getElementByID()
.
My question is, how do I select a hidden ASP control in JavaScript?
An element with Visible = false
is never rendered on the page, so you'll never be able to access it in JavaScript.
I would recommend hiding the element with style="display:none"
, like this:
item.Style.Add("display", "none");
Change the code to give it a hidden style instead, then it's easy
item.Style.Add("display", "none");
//javascript
document.getElementById("id").style.display = "block";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.