JSFiddle - React, Tailwind, and code Playground

HTML

<input id="search" type="text" value="mycurrtext" size="30" name="search" />

JavaScript

$(document).ready(function(){
    $("#search").focus(function(){
        if (this.setSelectionRange)
        {
        var len = $(this).val().length;
        this.setSelectionRange(len, len);
        }
        else
        {
        $(this).val($(this).val());
        }
   
});

$("#search").focus();
});