Skip to content

Home

Get selected text

Gets the currently selected text.

const getSelectedText = () => window.getSelection().toString();

getSelectedText(); // 'Lorem ipsum'

More like this

Start typing a keyphrase to see matching snippets.