ninja
ninja

Reputation: 2263

wp_editor(), how to fetch content with jQuery

I got a wordpress page where users can add posts from the front_end. For this i use the WP_editor() function.

When I was trying the functions just plain in a new wordpress page I could just use

tinyMCE.activeEditor.getContent();

But now I'm setting everything up as the final product should look like, this means the editor is loaded in a modalbox (using fancybox plugin), and it initalizes fine, and it works. But I can't fetch the content the same way, it just returns me with the following error:

 Uncaught ReferenceError: tinyMCE is not defined

I assume this has something to do with the modal box loading the page in an iFrame, meaning the editor isn't there when the javascript code is running. How do I solve this? Can I bind it to something like .live() ?

Seems like such an easy problem, guess I'm just to tired to be thinking clearly today.

Best Regards.

Upvotes: 3

Views: 2132

Answers (2)

Maarten Menten
Maarten Menten

Reputation: 111

In the WordPress version I use the JavaScript object tinymce and not tinyMCE. Try using tinymce.

Upvotes: 0

pawel
pawel

Reputation: 99

On the Front-End try to use wp_enqueue_script('tiny_mce') before.

Upvotes: 2

Related Questions