getSelection() broken in IE10
Asked Answered
A

1

6

I use the window.getSelection() method on my project to make a quotable text

It's working just fine in all modern browsers, exept IE10. In IE10 console returns correct text, but the selection is broken.

The only code I used:

text = window.getSelection().toString();
console.log(text);

This code calls on mouseup event.

Does anyone know the solution?

Aerosol answered 27/4, 2013 at 21:27 Comment(0)
C
2

try this should work for ie < 9.0

var texttest = document.selection.createRange();
alert (texttest.text);

this is for all browsers except ie < 9.0

var texttest = document.getSelection();
alert(texttest);
Contradict answered 11/11, 2013 at 19:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.