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