Now we're going to
add an id to the
input element.
<input size=10 id=MyInput>
(It doesn't matter what order we give the attributes inside an HTML tag).
Then the function can get a little fancier.
function DoMyThing() {
MyAnswer.innerHTML = "Hello + MyInput.value + " I hope you are well";
}
We're using the
value property of the
input box.
How do I know input boxes have values? I looked it up on w3schools.
Try typing something in the input box then clicking the button.