I'm pretty sure createTextRange
is an Internet Explorer specific method, which was used in IE v6, I believe.
I don't know which other versions of IE support it (maybe older versions, maybe newer versions), but it probably doesn't work in any other browser.
The old documentation that I was using year ago is gone, but I found this documentation about createTextRange
:
(I'm used to MS changing their URLs, so I hope these links are not broken again)
I'm not sure anymore how to use it properly, and I can't test it, as I don't have an InternetExplorer, but here I took some lines from some of my old codes (I simplified it here, so I might have broken something):
var elm = document.getElementById("sourceText");
elm.value = 'some text';
const rng = elm.createTextRange();
rng.collapse( true );
rng.moveEnd( 'character', 7 );
rng.moveStart( 'character', 2 );
rng.select();