GetSelection () is broken in IE10

I use the window.getSelection () method in my project to make quoted text

It works great in all modern browsers except IE10. In console, IE10 returns the correct text, but the selection does not work.

The only code I used:

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

This code raises the mouseup event.

Does anyone know a solution?

+6
source share
1 answer

try it, it should work, 9.0

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

this is for all browsers except <9.0

 var texttest = document.getSelection(); alert(texttest); 
+2
source

Source: https://habr.com/ru/post/943789/


All Articles