JSFiddle - React, Tailwind, and code Playground

HTML

<textarea id='t'>Click me!</textarea>

JavaScript

var searchText = "lic";
var t = document.getElementById("t");
var l = t.value.indexOf(searchText);
if(l!=-1){
t.focus();
t.selectionStart = l;
t.selectionEnd = l+searchText.length
}