2

I have a CKEditor textarea:

 <textarea id='notification_message' name='notification[message]'>

I am just trying to read the value of ckeditor textarea via below code:

  var message = $("textarea[name='notification[message]']").val();
  alert(message);

But it give me blank value. How could I get the ckeditor textarea value?

SSR
  • 6,398
  • 4
  • 34
  • 50
Robin Garg
  • 203
  • 2
  • 13
  • You may be interested in the [The jQuery Adapter](http://docs.ckeditor.com/#!/guide/dev_jquery), using this you can use the `$('textarea.editor').val();` as normal. – t.niese Nov 18 '15 at 07:32
  • 1
    Possible duplicate of [Getting the textarea value of a ckeditor textarea with javascript](http://stackoverflow.com/questions/7906085/getting-the-textarea-value-of-a-ckeditor-textarea-with-javascript) – webster Nov 18 '15 at 08:33

1 Answers1

3

Try like below

var value = CKEDITOR.instances['notification_message'].getData();
SSR
  • 6,398
  • 4
  • 34
  • 50
Jagadish
  • 372
  • 1
  • 3
  • 13