How to get the content of a Tinymce textarea with JavaScript

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

    lets say your mce textarea instance is:

    
    

    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

提交回复
热议问题