DOM & HTML
Selection API
Inspect and manipulate the range of text selected by the user in the document.
Checking support...
Feature Not SupportedThis browser does not support the Selection API Web API feature. Try testing in a modern browser (such as Chrome, Edge, Safari, or Firefox).
Advertisement
Interactive Input Workspace
Ready for input
Web API Execution Output
Result output will be displayed here after processing...
Native JavaScript Code Example (Zero Libraries)
const selection = window.getSelection(); console.log(selection.toString());
About the Selection API Web API
The Selection API represents the range of text selected by the user or the current position of the caret.
Specification:W3C & WHATWG Web API Standard
Sponsored Content