Name
Input.select( ) — select the text in a form element
Availability
JavaScript 1.0
Synopsis
input
.select( )
Description
The select( )
method selects the text displayed in
a Text, Textarea, Password, or FileUpload element. The effects of
selecting text may vary from platform to platform, but typically,
invoking this method produces the same result as the user dragging
the mouse across all the text in the specified Text object. On most
platforms, this produces the following effects:
The text is highlighted, often displayed with colors reversed.
If the text remains selected the next time the user types a character, the selected text is deleted and replaced with the newly typed character.
On some platforms, the text becomes available for cut-and-paste.
The user can usually deselect text by clicking in the Text object or by moving the cursor. Once deselected, the user can add and delete individual characters without replacing the entire text value.
Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.