<button id="button_A">Press me</button>
<h3 id="heading_A"></h3>
const buttonA = document.querySelector("#button_A");
const headingA = document.querySelector("#heading_A");
buttonA.onclick = () => {
const name = prompt("What is your name?");
alert(`Hello ${name}, nice to see you!`);
headingA.textContent = `Welcome ${name}`;
};
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.