Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

How to highlight selected text in IE 11

$
0
0

I have a prototype JS snippet here :-

if (document.selection) { // IE 8, 9, 10 var range = document.selection.createRange(); selectedText = range.text; selectionOK = this.highlightSelection(range); this.getOffset(); } else if (document.getSelection) { // IE 11 support see "http://msdn.microsoft.com/en-in/library/ie/ms535869(v=vs.85).aspx#properties" var range = document.getSelection().getRangeAt(0); selectedText = range.toString(); //selectedText = document.getSelection(); selectionOK = this.highlightSelection(range.createRange()); highlightSelection() is my custom function that accepts TxtRange and uses execCommand() to highlight the selected text. Now I am not able to convert range object to TxtRange and consequently, not able to highlight selected text in IE 11. how to get TxtRange in IE 11 ?



Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>