How to get tinyMCE content from more than one text area

后端 未结 2 1858
清歌不尽
清歌不尽 2021-01-12 18:35

Hi I have problem when I need to get the content from multiple text areas. So i saw that tinyMCE has methods to take content from specific text area or from active one, but

相关标签:
2条回答
  • 2021-01-12 19:02

    To reach multiple tinymce instances:

    http://www.tinymce.com/wiki.php/API3:property.tinymce.editors

    Example:

    for (edId in tinyMCE.editors)
        tinyMCE.editors[edId].save();
    

    and the best way (my opinion) would be to save the content to an array:

    for (edId in tinyMCE.editors)
        array[edId] = tinyMCE.editors[edId].getContent();
    
    0 讨论(0)
  • 2021-01-12 19:04

    Tinymce stores all its editors in an array: tinyMCE.editors. All you need to do is to loop through them and access the content:

    for (i=0; i < tinyMCE.editors.length; i++){
        var content = tinyMCE.editors[i].getContent();
        alert('Editor-Id(' + tinyMCE.editors[i].id + '):' + content);
    }
    
    0 讨论(0)
提交回复
热议问题