Auto Select Text

Simplify sharing. This script saves users from manually dragging their cursor to select text. One click highlights everything instantly.

Copy the Script

<!-- For Input Fields -->
<input type="text" value="Copy this text" onfocus="this.select()">

<!-- For Textareas -->
<textarea onfocus="this.select()">Select all content inside this box.</textarea>

Frequently Asked Questions

No, it only highlights (selects) it. To copy to the clipboard automatically, you would need to use `navigator.clipboard.writeText()` or `document.execCommand('copy')`.

Yes. On mobile devices, focusing the field will usually bring up the keyboard, and the `select()` method will highlight the text, making it easy to tap 'Copy'.

Yes. Add the `readonly` attribute to the `` tag so users can select and copy the text but cannot modify it.