I'm using CKEditor 5 to create a text-rich editor on each textarea
that has the class
.section-dynamique-fr
.
The editor is indeed appended to my html page.
Now, when I try to access the editor via javascript using e.nextElementSibling
, it does not return its nextElementSibling
as seen in the node tree from the console inspector, instead it returns e.nextElementSibling.nextElementSibling
.
Any idea why I can't access e.nextElementSibling? (the div with the class
.ck-editor
) ?
See attached image for html node structure
document.querySelectorAll('.section-dynamique-fr').forEach( (e) => {
ClassicEditor
.create( document.querySelector('#' + e.id), {
// toolbar: [ 'heading', '|', 'bold', 'italic', 'link' ]
} )
.then( editor => {
window.editor = editor;
thisEditor = editor;
} )
.catch( err => {
console.error( err.stack );
} );
console.log(e); //This gives me the textarea
console.log(e.nextElementSibling); //This should gives me the div with class ck-editor but instead gives me the div with class .textarea-saved-content-fr