Highlight text in a inputBox using JS

Hi,
I have a lot of textInput elements on a page. I want the text in each element to become “highlighted” (or “selected”) whenever the textInput get focus using JS.
The main goal is that I want the users on my site to be able to input and change a lot of data very quickly so I want to have this behavior that makes it that each time the textInput gets focus the user will be able to instantly rewrite whichever value is in thet textInput.
Is there a way to do so?
Thanks!