Skip to content Skip to sidebar Skip to footer

Ie <= 8 Equivalent To Selection.getrangeat()?

I need to get the range object of the current selection. The following works in most browsers: range = selection.getRangeAt(0); Is there an equivalent native JavaScript command f

Solution 1:

Sort of. IE <= 8 has selection and range functionality but it's very different to other browsers. The nearest equivalent is:

varrange = document.selection.createRange();

... which will (usually) create you a proprietary TextRange object representing the selected content.

At the risk of promoting my own stuff, you may be interested in my Rangy library, which provides a DOM Range and Selection API in all major browsers, in particular IE <= 8.

Post a Comment for "Ie <= 8 Equivalent To Selection.getrangeat()?"