Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
147
rated 0 times [  148] [ 1]  / answers: 1 / hits: 31787  / 10 Years ago, thu, april 10, 2014, 12:00:00

I have 2 textarea in a webpage which use tinyMCE.



<textarea id=id1 rows=10 cols=50 name=name1></textarea>
<textarea id=id2 rows=10 cols=50 name=name2></textarea>


On version 3 of TinyMCE, I was able to do this



$('#id1').tinymce().execCommand('mceInsertContent', false, content);


Now on version 4, I try to use the same code, but it didn't work. So, how can I insert content into the specific targeted textarea?


More From » jquery

 Answers
67

There are several possible ways.



In case your editor with id1 is the active Editor:



tinymce.activeEditor.execCommand('mceInsertContent', false, 'your content');


In case you want to use the id:



tinymce.get(id1).execCommand('mceInsertContent', false, 'your content');


In case you only have two editors and your editor with id1 has been initialized first:



tinymce.editors[0].execCommand('mceInsertContent', false, 'your content');

[#71533] Tuesday, April 8, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ravenl

Total Points: 338
Total Questions: 107
Total Answers: 112

Location: Belize
Member since Mon, Jun 20, 2022
2 Years ago
;