JavaScript / jQuery: how to get selected text in Firefox
问题 how can I get the selected text (in a contenteditable div) in Firefox ? It would be enough for recent versions, no need to cover old versions. Say I have a contenteditable div that looks like the below and someone selects a text there and then hits a button, how can I copy the selected text to the clipboard or a variable ? Example: <div class='editInput' id='editInput'>Some awesome text</div> My current function (working in IE): function GetSelection() { if (typeof window.getSelection !=