How to get the content of a Tinymce textarea with JavaScript
I solved it with code:
// Get the HTML contents of the currently active editortinyMCE.activeEditor.getContent();// Get the raw contents of the currently active editortinyMCE.activeEditor.getContent({format : 'raw'});// Get content of a specific editor:tinyMCE.get('content id').getContent()
the activeEditor is current editor,but i use tinyMCE.get('editor1').getContent() can not get the value of my editor, hope it can help you
Tinymce API: http://www.tinymce.com/wiki.php/API3:method.tinymce.Editor.getContent
lets say your mce textarea instance is:
<textarea id="editor1" ....></textarea>
then you get the content as follows:
var content = tinyMCE.getContent('editor1');
if you mean you have multiple instances of mce editor on one page and you want to get content then try this approach:
var inst, contents = new Object();for (inst in tinyMCE.editors) { if (tinyMCE.editors[inst].getContent) contents[inst] = tinyMCE.editors[inst].getContent();}
the above code adds each editor content into an array
I had the same problem. I have solved using this code:
tinyMCE.get('editor1').getContent();
Source: spocke is the author