JSFiddle - React, Tailwind, and code Playground

by Dave Appus

HTML

<!-- <input type="text" id="input1"> -->
<!-- <button type="submit" id="ac" onclick="autoFill();">Hello</button>  -->
<input type="button" value="test" id= 'ab'> 
<input data-v-18d53c78="" type="text" placeholder="Looks like 'xrb_1abcd...' or 'nano_1abcd...'" class="input" id="is-success">

JavaScript

async function pasteFunct(input) {
  const text = await navigator.clipboard.readText();
  input.value = text;
}
window.onload=isiForm();
/*
$('document').ready(function(){
	dopaste();
});
*/
function isiForm() {
	var input =  document.getElementById('is-success');
  input.focus();
  pasteFunct(input)
  console.log("hello")
}
//ab.addEventListener('click', function() { update()/* do stuff here*/ }, false);
var ab = document.getElementById('ab');
ab.addEventListener('click', (e) => { 
	var inp =  document.getElementById('is-success');
  pasteFunct(inp)
  //document.execCommand('paste');
});
//document.execCommand('paste');

//var ab = document.getElementsByClassName('is-success')[0];

/*
$('document').ready(function(){
    update();
});
*/
/*
function update() {
  var inp =  document.getElementById('is-success');
  var keyEvent = new KeyboardEvent("keypress", {key : "v", char: "v", ctrlKey: true});
  $(inp).val(keyEvent.key);
}
*/