Ckeditor starts twice when opening modal

0

I have a JS function to open a modal, Code:

$(document).ready(function() {
$('#eventosanalisis').on('click', '#editar_evento', function(e) {
    e.preventDefault();
    editor = CKEDITOR.replace( 'editor1', {
    });
    var filaactual = $(this).closest("tr");
    var id = filaactual.find("td:eq(0)").text();
    document.getElementById("nombremodalevento").innerHTML = filaactual.find("td:eq(1)").text();
    document.getElementById("fechamodalevento").innerHTML = filaactual.find("td:eq(2)").text();
    document.getElementById("municipiomodalevento").innerHTML = filaactual.find("td:eq(4)").text();
    document.getElementById("sectormodalevento").innerHTML = filaactual.find("td:eq(5)").text();
    editor.setData(filaactual.find("td:eq(3)").text());  
    UIkit.modal("#modal-editar", {bgclose: false, keyboard:true}).show();    
});
//limpiar ckeditor al cerrar modal
    $('#modal-editar').on('hidden',function (e) {
        CKEDITOR.remove(editor);
    });

});

When selecting a row in my table it works fine, but if I close the modal and select the same row again, the editor is shown twice

    
asked by arglez35 05.10.2018 в 23:15
source

0 answers