0
votes

I am writing a AJAX / session based helperfunction for copy&paste functionality on drupal forms.

But i am running into trouble, when it comes to accessing the CKEDITOR-instances.

When looking at CKEDITOR.instances in JavaScript they look like this:

edit-description-value

    Object { element={...}, elementMode=1, name="edit-description-value", mehr...}

edit-long-description-value

    Object { element={...}, elementMode=1, name="edit-long-description-value", mehr...}

That is the way drupal puts up the names automatically.

Replacing the content inside the editor-area with

CKEDITOR.instances[edit-description-value].setData("my textstring");
OR
CKEDITOR.instances[edit-long-description-value].setData("my textstring");

does not seem to work because of the "-" within the identifier. At least i think that could be the problem :-D

Can you guys give me a hint?

1

1 Answers

2
votes

Use the quotes, Luke:

CKEDITOR.instances['edit-description-value'].setData("my textstring");

CKEDITOR.instances['edit-long-description-value'].setData("my textstring");

Explanation. ES5 spec.