Sometimes, we want to get the text area value of a CKEditor text area with JavaScript.
In this article, we’ll look at how to get the text area value of a CKEditor text area with JavaScript.
How to get the text area value of a CKEditor text area with JavaScript?
To get the text area value of a CKEditor text area with JavaScript, we use the getData
method.
For instance, we write
<textarea id="editor1" name="editor1">This is sample text</textarea>
to add a text area.
Then we write
const editorText = CKEDITOR.instances.editor1.getData();
to call getData
to get the text area’s value.
Conclusion
To get the text area value of a CKEditor text area with JavaScript, we use the getData
method.