pawel
pawel

Reputation: 6136

How to get my formatted content from tinyMCE using javascript?

I've installed TinyMCE and when my form is posted traditional way (into some php page) it's not a problem, cause I can pass the variable throug stripslashes() function or something like that.

Unfortunately, one of my forms is passed via jquery $.ajax module - and there any PHP manipulations are impossible. Is there a way to pass full formatted tinyMCE output via javascript, because now it can't see any formatting i've done.

Upvotes: 0

Views: 4175

Answers (1)

manavo
manavo

Reputation: 1899

According to this answer: https://stackoverflow.com/a/6541822/349012 it's possible:

// Get the HTML contents of the currently active editor
tinyMCE.activeEditor.getContent();

// Get the raw contents of the currently active editor
tinyMCE.activeEditor.getContent({format : 'raw'});

// Get content of a specific editor:
tinyMCE.get('content id').getContent()

Another reference: https://stackoverflow.com/a/11112221/349012

Upvotes: 3

Related Questions