[Home] >  DOM >  Get the selected text

Get the selected text

JavaScript version

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