0

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?

Olli Bolli
  • 347
  • 5
  • 15

1 Answers1

1

Use the quotes, Luke:

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

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

Explanation. ES5 spec.

Community
  • 1
  • 1
oleq
  • 15,697
  • 1
  • 38
  • 65