JSFiddle - React, Tailwind, and code Playground

HTML

<input value="click me to autoselect"/>

JavaScript

$('input').click(function() {
 // the select() function on the DOM element will do what you want
 this.select();
});