Get selected text 4 Aug 2020 javascript document.onselectionchange = () => { const text = document.getSelection().toString() console.log(text) }