JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="input1" /><br />
<input type="text" id="input2" />
<button id="btnOK" onClick="mudarTexto();">
OK
</button>
JavaScript
function mudarTexto() {
document.getElementById("input2").value = document.getElementById("input1").value;
document.getElementById("input1").value = "";
}