To set a value in CKEditor with JavaScript, we use the setData
method.
For instance, we write
CKEDITOR.instances["fieldName"].setData("your data");
to get the CKEditor instance with CKEDITOR.instances["fieldName"]
.
Then we call setData
with "your data"
to set the field’s value to "your data"
.
Conclusion
To set a value in CKEditor with JavaScript, we use the setData
method.