I'm using ckeditor-7.2 version. How can I set the values to my ckeditor text area from out side.


1 Answer 1


Assuming you want to set some value at the beginning -

Get the id of the form. https://www.drupal.org/project/get_form_id

Get the id of the field you want to alter.

Make a small custom module, with hook_form_alter() and set #default_value to that :

function YOURCUSTOMMODULENAME_form_alter(&$form, &$form_state, $form_id) {
  if ( YOUR_FORM_ID == $form_id) {  
    $form['YOUR_FORM_ID']['YOUR_FIELD_ID']['#default_value'] = 'some default text'

For adding some text after taht that, use jQuery.

$('#input-field-id').val('some text');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.