javascript - Dynamic Creation of Editors - Does Browser need to exit the function to make the changes? -


i trying dynamically create , destroy tinymce editors . 1) appears if put break point , check tinymce editors after creation , i.e after first loop - dont see them in browser 2) nor see them in tinymce.editors in console

hence destroy not working . after , can see editors . because second loop won't executed .

question , there function has exit , browser makes dom changes ? if should put sleep ? got idea what javascript version of sleep()? i.e browser makes dom changes after function exists or . can enligthen me ?

for (var i=0;i<10;i++)      {     //i=0;     divobj = document.createelement('div');     divobj.classname = 'top_div';     divobj.id = 'top_div_' + i;     divobj.innerhtml = 'tiny editor';     var textareaobj = document.createelement('textarea');     textareaobj.classname = 'simpleedit';     textareaobj.id = 'nic_' + i;     textareaobj.style.csstext="width: 300px; height: 100px;";     divobj.appendchild(textareaobj);     document.body.appendchild(divobj);     tinymce.execcommand('mceaddcontrol', false, textareaobj.id);     }     editors = tinymce.editors.length;     (var i=0;i<editors;i++)    {      tinymce.remove(tinymce.editors[0]);     }  

you calling remove function right after create editors. thus, editor instances have not been created - reason not finding instances. right way here use tinymce init config param oninit, gets called when editor ready.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -