0

Node JAVASCRIPT CODE:

Editor= CKEDITOR.instances['ckeditor1'];


getElem=Editor.document.getSelection().getStartElement();
getElem.setHtml("<Element6>SomeText</Element6>");

Working On : FireFox

not working On : Internet Explorer

The Error is :`'Editor.document.getSelection() is null or not an object

how do i get Parent node of cursor position in IE?

DATA ON CKEDITOR:

<Element1>SomeText<Element2>SomeText</Element2>

<Element3>Some**[suppose Cursor Is Here]** Text </Element3>

</Element1>

Required Result:

 <Element1>SomeText<Element2>SomeText</Element2><Element3> 

<Element6>SomeText</Element6>

</Element3></Element1>
RGA
  • 602
  • 2
  • 9
  • 39
  • 1
    Focus editor (`editor.focus()`) and then get selection. If you know that editor is focused and you still can't get selection then you'd have to show us more code ((not) working example will be the best). – Reinmar Oct 17 '12 at 13:17

1 Answers1

0

Following code Working well.. Thanks to * Reinmar*

Editor= CKEDITOR.instances['ckeditor1'];
Editor.focus();
getElem=Editor.document.getSelection().getStartElement();
getElem.setHtml("<Element6>SomeText</Element6>");
RGA
  • 602
  • 2
  • 9
  • 39