How to get tinyMCE content from more than one text area

Hi I have a problem when I need to get content from several text areas. Thus, I saw that tinyMCE has methods for retrieving content from a specific text area or from an active one, but how to do this is all the text areas that I have (note: the number of text areas is not static).

I was thinking of an option to create a dynamic identifier for each text area, and when I need to send content to iterate through 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 this, but I don't know if this is correct. Please help me solve this problem. thanks in advance

+6
source share
2 answers

Tinymce stores all its editors in an array: tinyMCE.editors . All you have to do is skip 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); } 
+11
source

To get multiple instances of tinymce:

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) was to save the contents to an array:

 for (edId in tinyMCE.editors) array[edId] = tinyMCE.editors[edId].getContent(); 
+2
source

All Articles