Remarks You typically use the selection object as input from the user to identify which portion of the document to act on, or as output to the user to show the results of an action. Users and scripts can create selections.
Users create selections by dragging the mouse over a portion of the document.
Scripts create selections by calling the select method on a text range or similar object. To retrieve the active selection, apply the selection keyword to the document object. To carry out work on a selection, create a text range object from the selection using the createRange method. A document can have only one selection at a time. Although an empty selection contains nothing, you can use it to mark a position in the document.