asp.net.ph

Skip Navigation Links

selection Object

Language References


HTML 2, 3.2, 4, 4.01, 5

Represents the active selection, a highlighted block of text and/or other elements in the document upon which a user or a script can carry out some action.

You typically use the selection object as input from the user identifying what portion of the document to act on, or as output to the user showing the results of an action.

Remarks

Users and scripts can both create selections. Users create selections by dragging the mouse over a portion of the document. Scripts create them by calling the select method on a text range or similar object. You can retrieve the active selection by applying the selection keyword to the document object. To carry out work on a selection, you can create a text range object from the selection by using the createRange method.

A document can have only one selection at a time. The selection has a type that determines whether it is empty or contains a contiguous block of consecutive text and/or elements. Although an empty selection contains nothing, it is useful for marking a position in the document.

Members

selection Members



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note