Categories
JavaScript Answers

How to get the text area value of a CKEditor text area with JavaScript?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *