I'm new in JavaScript and I have a problem, it'll be great if someone could help me.
I'm trying to write something from one <p>
to h4
.
my code is:
function ok() {
document.getElementById("out").innerHTML = document.getElementById("name").value;
}
<label id="label">your text is:</label>
<br>
<input type="text" />
<p id="name" style="font-family: 'Courier New', Courier, monospace;"></p>
<button type="submit" id="click" onclick="ok()">click</button>
<h4 id="out" style="font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;"></h4>
but when I'm doing it I get undefined
.
If someone could help me understand what I'm doing wrong it'll be great.