1
How to clone the values of textarea
so that when typing in textarea 1
the textarea 2
receives this value and when typing in textarea 2
the textarea 1
receives the amount?
I tried to document.getElementById("ta").value = document.getElementById("ta2").value
, but it only works if you type in 1 and cannot type in 2
function preview() {
var valor = document.getElementById("ta").value
var valor2 = document.getElementById("ta2").value
var preview = document.getElementById("preview")
var preview2 = document.getElementById("preview2")
preview.innerHTML = valor
preview2.innerHTML = valor2
};
<textarea id="ta" oninput="preview()">Um</textarea>
<textarea id="ta2" oninput="preview()">Um</textarea>
<div id="preview"></div>
<div id="preview2"></div>