multiple ckeditor on same page code example

Example: multiple ckeditor on same page

/*HTML CODE*/

/*

<script src="https://cdn.ckeditor.com/ckeditor5/18.0.0/classic/ckeditor.js"></script>

<p><textarea  placeholder="Description"  id="body1" name="body"></textarea></p>
<p><textarea  placeholder="Description"  id="body2" name="body"></textarea></p>
<p><textarea  placeholder="Description"  id="body3" name="body"></textarea></p>

*/

document.addEventListener("DOMContentLoaded", function(event) { 
var numb = 1;
  do {
    ClassicEditor
    .create( document.querySelector( '#body'+ numb ), {
      removePlugins: [ 'insertImage', 'insertMedia', 'Link', 'blockQuote' ],
      toolbar: [ 'Heading', 'bold', 'italic', 'bulletedList', 'numberedList',  ]
    } ) 
    .catch( error => {
      console.error( error );
    } )
    numb++;
  }
  while (numb < 3);
});

Tags:

Misc Example