The select() method of the HTMLInputElement interface selects all the text in an element that includes a text field.
select()
MDN Reference