I need it to work also for FF. is there a browser neutral way to do this?
Main Topics
Browse All Topicsany experts for GWT?
I have a native method which uses
$doc.selection.createRange
I am not sure why the $ before doc. I simply copied it from some sample code. this method works find when in hosted mode. but after compile and called directly from a browser I get the $doc.selection is undefined error.
any one knows what's wrong with this?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
This might help?
http://www.webreference.co
It looks kinda old, but it works on FF
I tried the suggested scripts, I am getting different results
if (document.getSelection) {
var range = document.getSelection().cr
} else if (document.selection && document.selection.createR
var range = document.selection.createR
} else {
var str = "Sorry, this is not possible with your browser.";
}
I use the range to get the parent Element, range.parentElement();
originally (using $doc), I get back a div, now I am getting back the BODY element.
document.selection does not seem to be equivalent to $doc.selection, even though it removes the browser incompatibility.
any ideas?
Business Accounts
Answer for Membership
by: TimYatesPosted on 2009-06-04 at 01:47:34ID: 24544696
What browser are you using?
$doc.selection should (I believe) translate to document.selection in javascript, which is only supported by IE