With this simple example, I want the p element to get the current value of text input but cannot figure out. The value doesn't change.
function myFunction() {
document.getElementById("myText").value = "Johnny Bravo";
}
document.getElementById("p1").innerHTML = document.getElementById("myText").value;
Name: <input type="text" id="myText" value="Mickey">
<p id="p1">Click the button to change the value of the text field.</p>
<button onclick="myFunction()">Try it</button>