There is a code that adds / deletes input with the CKEditor editor:
$("#add").click(function(e) { $("#items").append('<div><input name="content[]" type="text" class="form-control ckeditor"/><button id="delete" type="button" class="btn btn-danger">Удалить</button></div>'); }) .on('click', function() { CKEDITOR.replace('content[]'); }); $("body").on("click", "#delete", function(e) { $(this).parent("div").remove(); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdn.ckeditor.com/4.7.0/standard/ckeditor.js"></script> <div><button id="add" type="button" class="btn btn-success">Добавить поле</button></div> <div id="items"> </div> The problem is that CKEDITOR.replace() triggered by the name identifier, i.e. when I try to add another input with the editor, I get the error Uncaught The editor instance "content[]" is already attached to the provided element.
How to use this feature
.on('click', function () { CKEDITOR.replace('content[]'); }) to each new input ?
I tried to use the replaceAll method , the editor does not load at all.
Ckeditor? - Raz GalstyanДобавить полеdo you want to get a second editor after the first? I understood correctly? or just clean the first one? - Raz Galstyan