Answer the question
In order to leave comments, you need to log in
How to insert a tag in a textarea?
There is a text area
<textarea name="content" id="id_content"></textarea>
document.addEventListener("DOMContentLoaded", function (event) {
var editor = CKEDITOR.replace('id_content');
});
CKEDITOR.instances.id_content.insertHtml('<p>This is a new paragraph.</p>');
Uncaught TypeError: CKEDITOR.instances.id_content is undefined
console.log(CKEDITOR.instances['id_content'])
console.log(CKEDITOR.instances)
document.addEventListener("DOMContentLoaded", function (event) {
var editor = CKEDITOR.replace( 'id_content', {
on: {
instanceReady: function() {
this.insertHtml( '<h1>someText</h1>' );
}
}
} );
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question