jquery - instance of CKeditor already exists -


i have found few similar posts on over stack overflow there none answer working.

i have few tabs on page, depending on li click on see specific tab. in 1 of tabs there ckeditor initiated on click of li. when user clicks off specific tab onto one, , returns there error:

uncaught editor instance "employdesc" attached provided element.

here js:

    $('.addvacancy').click( function() {         if(ckeditor.instances.employdesc)  {             alert('instance exists');             var editor = ckeditor.instances[employdesc];             if (editor) {                  editor.destroy(true);              }              alert('distroyed');         }            ckeditor.replace('employdesc');     }); 

both of alerts appear breaks error comes on in console. can this?

thanks

you're trying use variable named employdesc, should use ckeditor.instances["employdesc"]; or just

$('.addvacancy').click( function() {     var editor = ckeditor.instances.employdesc;     if (editor) {         alert('instance exists');         editor.destroy(true);          alert('destroyed');     }        ckeditor.replace('employdesc'); }); 

it's same trying do.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -