I am trying to hide a button after onclick event with JavaScript. My button is located at the top of the page so when someone clicks on it, content is showed but the button still on the page. I was thinking if I could hide it after the user click on the button.
Do you have any hint on how to do it?
Here is the code that I am using:
function showDiv() {
document.getElementById('menuDiv').style.display = "block";
}
#menuDiv{
display: none;
}
<div class="text-center">
<button onclick="showDiv()" class="btn btn-light"><img src="images/cartoon-cookie.png" alt="Cookie"
style="height:100px;">Yes, I want to see the menu</button>
</div>
<div id="menuDiv">
<!-- here is the content that is revealed after the on click event -->
</div>