JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" value="click me to autoselect" />
<input type="url" value="click me to autoselect" />
JavaScript
$("input[type=text], input[type=url]").click(function() {
// the select() function on the DOM element will do what you want
$(this).select();
});