/

Get selected text

javascript
js
document.onselectionchange = () => {
const text = document.getSelection().toString()
console.log(text)
}
Edit this page
Want to make your own site like this?
Try gatsby-theme-code-notes by Zander Martineau.
Notes on code. My second brain, by Zander Martineau.