getSelectedText
Gets the currently selected text.
- Use
Window.getSelection()andSelection.toString()to get the currently selected text.
const getSelectedText = () => window.getSelection().toString();getSelectedText(); // 'Lorem ipsum'
Gets the currently selected text.
Window.getSelection() and Selection.toString() to get the currently selected text.const getSelectedText = () => window.getSelection().toString();getSelectedText(); // 'Lorem ipsum'