Programming Snippets
To keep this readable for everyone on this globe, these pages will be in english.
The first snippet is about tinyMCE, a WYSIWYG javascript editor.
Many try to use it with ajax, but get to a point where it won’t be “initialized” after a page refresh.
The problem is, that the page will be refreshed, but the javascript or better, the tinyMCE object isn’t.
My solution first removes all the old editors in the tinyMCE.editors object. This works perfect for me.
Because I use php and jquery, you may find these back in my examples.
$("#$FormId").submit( function () { if ("object" == typeof tinyMCE) {
tinyMCE.triggerSave();
l = tinyMCE.editors.length;
for (var i = 0;i < l;++i) {
tinyMCE.editors[0].remove();
}
}

Leave a Comment