Within an ASP.NET master page, there is a specific div element that I want to hide in one of its content pages. To achieve this, I included the following JavaScript code at the end of the content page:
if (document.getElementById('sitemap')) {
document.getElementById('sitemap').style.display = "none";
}
The sitemap div is located in the master page. When debugging the JavaScript, the code successfully targets the 'sitemap' element but fails to hide it. Why is this happening? How can I properly modify the style of a master page's DOM element from a content page? Any suggestions are appreciated. Thank you.