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 () {
this.selectionStart=0;
this.selectionEnd=this.value.length;
return false;
});