I've finally figured it out for anyone else with similar problems:
selectText = function(node, text)
{
if (window.getSelection)
{
node.selectionStart = node.value.lastIndexOf(text);
node.selectionEnd = node.value.lastIndexOf(text) + text.length;
node.focus()...
Here is the scenario: I have a textarea with text in it and I want to select/highlight predefined text within the textarea with a function. This code using ranges works with IE -
selectText = function(node, text)
{
var range = document.body.createTextRange();
range.moveToElementText(node)...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.