سؤال

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?

هل كانت مفيدة؟

المحلول

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);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top