How to get the content of a Tinymce textarea with JavaScript

后端 未结 10 2116
忘掉有多难
忘掉有多难 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:41

    In my case (v4.3.12), none of the above worked, so I did a workaround:

    Html code:

    JQuery code:

    var iframe = $('#editable_container_ifr');
    var editorContent = $('#tinymce[data-id="editable_container"]', iframe.contents()).html();
    console.log(editorContent);
    

    Where editable_container is my tinyMCE editor's placeholder textarea, the editable area's iframe id is generated from adding a _ifr postfix to the placeholder's id, and the content-editable container (which contains the formatted text), has an id tinymce with a data-id attribute of the placeholder's id.

提交回复
热议问题