prompt not working
by trentHarlem
HTML
<p>This simple prompt box example doesn't work...</p>
<div id='w3'>
<p>Click the button to demonstrate the prompt box.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
</div>
<p>
from:
https://www.w3schools.com/jsref/met_win_prompt.asp
</p>
CSS
#w3 {
padding: 1em;
border: 1px solid black;
}
JavaScript
function myFunction() {
console.log('button works')
const person = prompt("Please enter your name", "Harry Potter");
if (person != null) {
document.getElementById("demo").innerHTML =
"Hello " + person + "! How are you today?";
}
}