I’m making a prank .html page for a friend. The prank was, you would push a button and a phrase would pop up under the button. I figured out a way to hide the phrase and unhide it. The problem is that, when you load into the page, the phrase would already be on the screen. How do I keep it hidden on page load?
function Function() {
var x = document.getElementById("urmom");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
<p>Click the "Try it" button to toggle between hiding and showing the DIV element:</p>
<button onclick="Function()">Try it</button>
<div id="urmom">
ur mom
</div>
<p><b>Note:</b> The element will not take up any space when the display property set to "none".</p>