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

Text Selection With TextRanges

$
0
0

I am using the following code to attempt to select text with TextRange objects in a WebView.If the text I'm trying to select is within a single element it works fine. If the coordinates specified by the start/end TextRanges span multiple elements, I get an "Unspecified Error". Am I misunderstanding the use of TextRanges? Are we not allowed to select across elements?

var start = document.body.createTextRange();
start.moveToPoint(20, 20);
var end = document.body.createTextRange();
end.moveToPoint(20, 100);
start.setEndPoint("EndToEnd", end);
start.select();



Viewing all articles
Browse latest Browse all 3527

Trending Articles



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