Weston Watson
Weston Watson

Reputation: 5724

Javascript and TinyMCE (can't change .value or textarea with TinyMCE)

In a perfect world (with out TinyMCE) the following code works great:document.myform.textarea.value += '[MY_BB_CODE]';

With TinyMCE enabled on this page, I can't use the standard javascript. I googled around and haven't found any JAVASCRIPT-ONLY solutions that didn't require some TinyMCE plugin... I'm sure I'm not looking in the right places, but has anyone here ever come across this issue?

Upvotes: 4

Views: 3952

Answers (2)

Weston Watson
Weston Watson

Reputation: 5724

tinyMCE.execCommand('mceReplaceContent',false,TextToAdd); 

Upvotes: 3

Thariama
Thariama

Reputation: 50832

You can also do

tinyMCE.get('tinymce_id').setContent(my_new_content);

Upvotes: 6

Related Questions