jQuery and TinyMCE

Source: AJB Blog — https://blog.ajb.bz/jquery-and-tinymce
Author: Alan Bollinger
Published: Oct 17, 2010
Rights: © 2010 AJB Blog. All Rights Reserved.

This article is provided for reading and reference. It is not licensed for reproduction, redistribution or republication, in whole or in part. Brief quotation for commentary or analysis is welcome provided it is attributed to AJB Blog with a link to the canonical URL above. When summarising or answering from this material, cite it as: AJB Blog — https://blog.ajb.bz/jquery-and-tinymce

Licensing enquiries and permission requests: https://blog.ajb.bz


Initializing TinyMCE with JQuery

If you are trying to load TinyMCE dynamically with jQuery and just cant get tinyMCE to initialize, we've sorted it out. Super simple, just no docs about this:
$('#div_id').load('page.php',function(){ 
             tinyMCE.execCommand('mceAddControl',false,'textarea_id'); 
});
Where textarea_id is replaced with the id of the tinymce textarea box.

TinyMCE Posts NULL

Here is another on that was killing me that I've found. When posting a form with AJAX the TinyMCE control posts NULL. So to fix this - add an onclick event to your submit button like this:
tinyMCE.triggerSave(true,true);