简体   繁体   中英

Get content of tinyMCE?

I have a text area with the id of 'article'.

Here is what is in my js:

tinyMCE.init({
        theme : "advanced",
        mode : "textareas",
        plugins : "fullpage",
        theme_advanced_buttons3_add : "fullpage"
    });

And to get the contents of the editor:

var content = tinyMCE.get('article').getContent();
    alert(content);

But it doesn't appear to work, any ideas where I'm going wrong?

tinyMCE.activeEditor.getContent()

Try to follow this fiddle it may help you in figuring out....

tinyMCE.init({
    theme : "advanced",
    mode : "textareas",
    plugins : "fullpage",
    theme_advanced_buttons3_add : "fullpage"
});

Function for getting content

function get_content() {
var content = tinyMCE.get('article').getContent();
alert(content);
}


<textarea name="article">
  //content here
</textarea>

Get the content of editor on button click ...

<button onclick="get_content()">Get content</button> 

DEMO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM