Represents the text selection in the greater page, possibly spanning multiple elements, when the user drags over static text and other parts of the page.
OverviewSelection is the class of the object returned by window.getSelection() and other methods. For information about text selection in an individual text editing element, see Input, TextArea and document.activeElement which typically return the parent object returned from window.getSelection().
PropertiesAdds a Range to the current selection.
The clear() method is not in HTMLSelection Object.
Use the removeAllRanges Method instead.
Replaces the current selection with an empty selection (or a caret) at the given offset.
Collapses or sets the insertion point or caret at the end of a selection object.
If the content the selection is in is focused and editable, the caret will blink there.
No events.
ExamplesA selection object represents the ranges that the user has selected. Typically, it holds only one range, accessed as follows:
var selObj = window.getSelection();
if(selObj.rangeCount){ range = selObj.getRangeAt(0);}
Related specifications
Mozilla Developer Network : [Selection Object Article]
Microsoft Developer Network: [HTMLSelection Object Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4