Monday, August 14, 2006

TinyMCE - Ajax and Content

So I was stumped on this one for a while:

With tinyMCE you can use text areas as wysiwyg editors. Well, when you try to submit the content using ajax methods you may try this...

var htmlContnet = document.getElementById(id_of_textbox).value;

this will NOT work (trust me, I found out the hard way)

instead you can get/set the content as follows

my_html_content = '

Hi!

';
tinyMCE.getInstanceById(id_of_the_parent_textarea).contentDocument.body.innerHTML = my_html_content;

RTFM!!!!
(check out: this)

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home