I am new to stackoverflow, and I am also an amateur javascript programmer. I am trying to make a program in which, when I click one button, a prompt appears, asking for my name. Alongside that, I also want that button to disappear, and be replaced with another button with the value: Hello 'name'. How do I do this? My code that I currently have in javascript asks me for my name, but does not make the button disappear. My current js is as follows:
var button = document.getElementById("button");
function naming() {
var getName = prompt("What is your name?");
button.style.display = "none";
};
And my html for the button:
<button id="button" onclick="naming();"> Name Here</button>