HTML, javascript - Displaying input value to a label
I want to display the value of an <input> to a label or something like
that, by using onkeyup so it's real time. But can only do it by using a
second input instead of the label but I just want to display the value.
This is my Javascript function:
function copyTo(obj) {
document.getElementById("utmatning").value = obj.value
}
And the HTML:
<label>E-post:</label>
<input id="inmatning" type="text" onkeyup="copyTo(this)"
placeholder="Skriv in e-post…">
<span>Vår återkoppling kommer att skickas till:</span>
<br>
<label id="utmatning"></label>
No comments:
Post a Comment