JSFiddle - React, Tailwind, and code Playground

by alexbfree

HTML

<script type="text/javascript">
function doFocus(e) {
  console.log(e);
  document.getElementById('editable').focus();
}

document.getElementById('clicker').addEventListener('onclick',doFocus, true);

</script>
<p id="editable" contenteditable="true" 
onfocus="document.execCommand('selectAll',false,null);">Your Text Here</p>

<button id='clicker'>Click me</button>