1

So i am trying to have a custom textarea where users can do things like bold text, add ul's,link tags and so on. For all of this I am using the wp_editor() function inside wordpress, like this.

 $content = "";
 $editor_id = "e_id";
 $editor_settings = array(
                         'teeny' => true,
                         'editor_height' => 160,
                         'quicktags' => array( 'buttons' => 'strong,em,del,close' ),
                         'media_buttons' => false );

 wp_editor( $content, $editor_id ,$editor_settings ); 

So everything such as adding links bolding text and so on works just fine.

My issue is accessing the text that was just typed into this field. I tried accessing the text using JQuery, by alerting the value of the textarea/contenteditable area like so...

  alert($("#e_id").val());

but each time the result is always an empty string and not the newly typed text.

How do I get a hold of the newly typed text

1 Answers1

2

So while looking around on here I found a similar question related to the Wordpress wp_editor() function. Here

Apparently there is a special tinyMce function used to access wp_editor() or the tinyMce editor's text/content.

So using this inside inside my onSubmit handler:

 tinyMCE.activeEditor.getContent()

I was able to get content or text that was entered into the wp_editor().

Also another good post on the subject.