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}`; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter