diff --git a/selText.js b/selText.js new file mode 100644 index 0000000..0ef8505 --- /dev/null +++ b/selText.js @@ -0,0 +1,13 @@ +$(function(){ + $(document.body).bind('mouseup', function(e){ + var selection; + + if (window.getSelection) { + selection = window.getSelection(); + } else if (document.selection) { + selection = document.selection.createRange(); + } + + selection.toString() !== '' && alert('"' + selection.toString() + '" was selected at ' + e.pageX + '/' + e.pageY); + }); +}); \ No newline at end of file