Hello, everyone.
I'm new to JS and I'm struggling to implement a very-simple condition to my forum.
I have a header added through the "custom header html" option in admin preferences. I'm using a nice image in it and it worked out just fine.
However, I'd like to make it go away if the user is not on the homepage. Specifically, what I'd like to do is to change the CSS property display to none if the script detects that I'm not on the homepage.
I have tried inserting this code into the header HTML, but with no success:
<script>
if ( !document.URL.includes("homepage.aspx") ) {
document.getElementById("#header").style.display = "none";
}
</script>
When checking the console on devtools, I find the following error message: Uncaught TypeError: Cannot read properties of null (reading 'style').
What should I do, then? Thank you all in advance for the attention.