JSFiddle - React, Tailwind, and code Playground
HTML
<input type="button" value="Select cup" onmousedown="selectCup(); return false">
<input type="text" id="test" value="Cup of tea">
JavaScript
function selectCup() {
var input = document.getElementById("test");
input.setSelectionRange(0, 3); // Highlights "Cup"
input.focus();
};