JSFiddle - React, Tailwind, and code Playground
HTML
<input id="p1" />
<br />
<br />
<br />
<br />
<div id="clickme">select text</div>
JavaScript
$('#clickme').click(function() {
document.getElementById("p1").selectionStart = 0
document.getElementById("p1").selectionEnd = 999
});