WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to used TextArea with Wysiwyg editor. That works when textarea is write on page ( Not dynamic , static ).. but my problem is for dynamically textarea.

My code :

add_action('admin_head', 'load_tiny_mce');
  function load_tiny_mce() {
     // The 'mode' and 'editor_selector' options are for adding
      // TinyMCE to any textarea with class="tinymce-textarea"
      wp_tiny_mce(true, array(
          'mode' => 'specific_textareas',
         'editor_selector' => 'tinymce-textarea'

I added textarea with javascript code when i push a button. textareas is basic not with wysiwyg editor ... ! I think i need to bind function ... but how to !

I hope, you understand me .. !


share|improve this question
up vote 2 down vote accepted

Add this function to you JavaScript:

function textarea_to_tinymce(id){
    if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
        tinyMCE.execCommand('mceAddControl', false, id);

then when you create the textarea dynamically call it and pass the textarea's id to it.

Just make sure TinyMCE is loaded on that page before or it won't work.

share|improve this answer
I added that following code : <script type="text/javascript" src="/wp-includes/js/tinymce/tiny_mce.js"></script> <script type='text/javascript'> function textarea_to_tinymce(textarea_id){ if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) { alert(textarea_id); tinyMCE.execCommand('mceAddControl', false,textarea_id); } } Alert display my textarea's id but that doesn't works :( – Mepps Nov 24 '11 at 11:07

any reply button on the comments is automated like :

<a class="comment-reply-link"
onclick="addComment.moveForm("comment-" + id , id , "respond",
response) >Beantwoorden</a


as far as i have found now, you can not change the onclick event to some function in where you could add this execCommand.

Maybe this page helps you:

share|improve this answer
How does this answer the question? – toscho Feb 15 '12 at 1:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.