I have a quick question about tinyMCE. I have a textarea, with id="mainbuffer"
, and the function tinyMCE.get(id).setContent(data)
.
ONLY works when it is called onclick="function()"
from a link and does not work when I load the page. In my case, it is: tinyMCE.get('mainbuffer').setContent( localStorage.getItem('mainbuffer') );
I've tried tinyMCE.execCommand()
, but that doesn't work either.
I want the JavaScript function to initialize the textarea with data stored in localStorage, which I have checked, is working fine. Any suggestions?
If you want to put script on page load, make sure you put your code in document.ready or after TinyMCE and your element has been loaded.