Get selected text

PHOTO EMBED

Wed Jan 05 2022 11:32:55 GMT+0000 (UTC)

Saved by @desiboli ##javascript ##js

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

Get the text the user has selected using inbuilt getSelectionproperty.

https://blog.devgenius.io/15-javascript-codes-you-will-always-need-e8569903dd1