Possible Duplicate:
getSelection() not working in IE
I was trying to get the selected content, and I found this:
window.getSelection().toString();
It works in most of the browser, except the obvious, IE.
So, what to do?
Possible Duplicate:
getSelection() not working in IE
I was trying to get the selected content, and I found this:
window.getSelection().toString();
It works in most of the browser, except the obvious, IE.
So, what to do?
Only IE9 onwards supports window.getSelection()
. You can use document.selection
instead in earlier versions.
The full syntax was:
document.selection.createRange().text;