JSFiddle - React, Tailwind, and code Playground
HTML
<script type="text/javascript">
function setTest(x)
{
document.getElementById(x).value = "this is a test value";
}
</script>
<input type="text" name="test" id="test" size="10" value="lalala">
<button value="FILL" onClick="if( confirm( 'Are you sure you want to set this field.') ){ setTest('test'); }">