Getting the value from a TinyMCE textarea

Try

window.parent.tinymce.get('contentID').getContent();

For some reason, the stock-standard tinymce.get() call didn't work for me, so I tried this and it works. :)


Use below syntax, which will remove unwanted character from your input textarea....

(((tinyMCE.get('YourTextAreaId').getContent()).replace(/(&nbsp;)*/g, "")).replace(/(<p>)*/g, "")).replace(/<(\/)?p[^>]*>/g, "");

TinyMce has an api for accessing content from the editor.

This code will grab the html from the active editor:

// 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()

var temp = tinymce.get('textAreaName').save();
console.log(temp);

OR

var temp =tinymce.get('textAreaName').getContent();
console.log(temp);