问题描述
当我需要从多个文本区域获取内容时,我遇到了问题.因此,我看到tinyMCE拥有从特定文本区域或活动文本区域中获取内容的方法,但是该方法将使我拥有的所有文本区域(请注意:文本区域计数不是静态的).
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 how to do it will all text areas that i have ( note : Text areas count is not static ).
我正在考虑使用变体来创建每个文本区域的动态ID,以及何时需要提交内容以遍历所有文本区域的动态ID.像这样的东西:
I was thinking for variant to create dynamic ID of each text area and when i need to submit the content to iterate thru all of them. Something like that:
for 0 to my textareas length
var all content = tinyMCE.get('area1').getContent();
var all content += tinyMCE.get('area2').getContent();
类似的东西,但我不知道这是否是正确的方法.请帮助我解决这个问题.预先感谢
Something like that but i don't know if this is the right way. Please help me to solve that issue. Thanks in advance
推荐答案
Tinymce将其所有编辑器存储在一个数组中:tinyMCE.editors
.您需要做的就是遍历它们并访问内容:
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);
}
这篇关于如何从多个文本区域中获取tinyMCE内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!