How to get the content of a Tinymce textarea with JavaScript

后端 未结 10 2057
忘掉有多难
忘掉有多难 2020-12-02 20:08

i have an array of content then how we get content of Tinymce textarea in javascript

相关标签:
10条回答
  • 2020-12-02 20:43
    
    tinymce.activeEditor.getContent();
    
    
    0 讨论(0)
  • 2020-12-02 20:48

    I solved it with code:

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

    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

    0 讨论(0)
  • 2020-12-02 20:48

    You may use:

    tinymce.get(editorid).getContent();
    
    0 讨论(0)
  • 2020-12-02 20:48

    Use the getContent() method from the TinyMCE API.

    Let’s say you have initialized the editor on a textarea with id=”myTextarea”. First access the editor using that same id, then call getContent(). For example:

    var myContent = tinymce.get('myTextarea').getContent();

    Or, instead of accessing the editor by id, you can access the active editor:

    var myContent = tinymce.activeEditor.getContent();

    If want to get the TinyMCE content without the HTML tags, you can pass in a parameter to indicate that you want the result in plaintext. For example:

    var myContent = tinymce.get('myTextarea').getContent({format: 'text'});

    More info and examples here: https://www.tiny.cloud/blog/how-to-get-content-and-set-content-in-tinymce.

    0 讨论(0)
提交回复
热议问题