Is there a javascript function that will allow me to capture the text that is currently highlighted with the cursor and store it in a variable? I\'ve been trying document.se
function getSelectedText() { if (window.getSelection) { return "" + window.getSelection(); } else if (document.selection && document.selection.type == "Text") { return document.selection.createRange().text; } return ""; }