JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" value="This text will be selected when you click in this input" />
CSS
input {
width:100%;
margin:0 auto;
text-align:center;
}
JavaScript
$("input").click(function () {
window.document.execCommand('SelectAll', true);
return false;
});