JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="txtOne" />
<button id="btnCopy">Copy</button>
<hr />
<input type="text" id="txtTwo" />
<button id="btnPaste">Paste</button>
JavaScript
var stored = '';
$('#btnCopy').click(function(){
var txt1 = $('#txtOne').val();
if (txt1){
stored = txt1;
console.log('stored:',stored);
}
});
$('#btnPaste').click(function(){
var txt2 = $('#txtTwo').val();
if (stored){
$('#txtTwo').val(stored);
}
});