read selected text using javascript code example Example: get selected text js Click to copy// Get highlighted text this way: window.getSelection().toString()