I am making a web page and i want to get the highlighted text. Problem is,i want to do something when a user highlights text anywhere within the page.
I have this
$("body").select( function (e) {
alert("You selected: "+window.getSelection());
});
here https://jsfiddle.net/xn9mnmy1/
but it does not seem to work.
What could i be doing wrong?.