title: When using javascript to dynamically and a textarea, how can I render it as a tinyMCE editor (in wordpress)?
body: <p>I have a plugin that allows the user to dynamically add sections that need to have the tinyMCE editor in them. The jQuery clones a <code>div</code> and places it into a container. One of the input boxes is a textarea set up like so:</p>
  
  <p><code>&lt;textarea name="sectionContent_1" id="sectionContent_1"&gt;&lt;/textarea&gt;</code></p>
  
  <p>I need to replace the textarea with the tinyMCE editor. </p>
  
  <p>I've looked at:</p>
  
  <p><a href="https://wordpress.stackexchange.com/questions/51776/how-to-load-wp-editor-through-ajax-jquery">How to load wp_editor() through AJAX/jQuery</a>
  and
  <a href="https://stackoverflow.com/questions/21519322/use-wordpress-wp-editor-in-dynamic-ajax-html">use wordpress wp_editor in dynamic/ajax html</a></p>
  
  <p>Neither of these seem to work for us</p>
  
  <p>I've tried this inside the trigger that calls to add the textarea section:</p>
  
  <pre><code>$(this).parent().find('.sectionOptions').html(ctHolder);
  
  var textAreaID = 'sectionContent_'+sectionID;
  
  tinyMCE.execCommand('mceRemoveEditor', true, textAreaID);
  tinyMCE.execCommand('mceAddControl', false, textAreaID);
  </code></pre>
  
  <p>In this, I'm adding the cloned data (ctHolder) to the <code>.sectionOptions</code> setting the textarea's ID, resetting the editor on the ID, then adding control to the ID... this doesn't work but seems to be most commons suggestion.</p>