Returns the number of ranges in a selection
Property of dom/Selectiondom/Selection
SyntaxNote: This property is read-only.
var rangecount = selObj.rangeCount;
Return Value
Returns an object of type NumberNumber
The number of ranges in a selection.
Examplesvar selObj=window.selection();
var rangecount=selObj.rangeCount;
Notes Remarks
Windows Internet Explorer 9-11 does not currently support multiple or disjointed selections in standards mode. This property always returns a 1 with a valid selection. It returns a 0 if removeRange or removeAllRanges have been applied, though calling isCollapsed is recommended instead to detect an empty range.
Before the user has clicked a freshly loaded page, the rangeCount is 0. A user can normally only select one range at a time, so the rangeCount will usually be 1. Scripting can be used (currently) in Gecko to make the selection contain more than 1 range.
Syntax Standards informationMozilla Developer Network : [Selection.rangeCount Article]
Microsoft Developer Network: [rangeCount Property 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