I'm developing a WordPress these days. I use the javascript code below to get the selected text in an active editor.
ed = FCKeditorAPI.GetInstance("content");
tag=ed.Selection.GetSelection();
However, this works well in Firefox, but it doesn't work in either IE6 or IE7.
I try to use Firebug to debug the script and I find out that the GetSelection() method returns an object and Firefox will automatically cast this object to a string, which is not the case in IE.
Then I add "alert(tag)" to the code, and in IE the alert prompt is [object] which also comfirms that IE treat the return of the GetSelection() method as an object.
Can anyone tell me how to get this work in IE?
ed = FCKeditorAPI.GetInstance("content");
tag=ed.Selection.GetSelection();
However, this works well in Firefox, but it doesn't work in either IE6 or IE7.
I try to use Firebug to debug the script and I find out that the GetSelection() method returns an object and Firefox will automatically cast this object to a string, which is not the case in IE.
Then I add "alert(tag)" to the code, and in IE the alert prompt is [object] which also comfirms that IE treat the return of the GetSelection() method as an object.
Can anyone tell me how to get this work in IE?
Re: GetSelection() not work in IE
if I replace all the GetSelection() with GetSelectedElement(), I always get null both in Firefox and IE
Re: GetSelection() not work in IE
Hi,
Look at http://www.fckeditor.net/forums/viewtopic.php?f=6&t=8814&p=23940
I think the solution is there!
Re: GetSelection() not work in IE
Great help, but this
still doesn't work in IE7, which was said to work in ff,ie and safari(pc).
I always get an empty string in IE7
Re: GetSelection() not work in IE