JS on Demand or Help to Initialize Invisible Object

V

vunet.us

Hello,
I am installing TinyMCE on my app. TinyMCE is a free HTML editor.
Initializations goes well when I include one JavaScript file and add
initialization code inside of HTML page, something like this:

<script language="javascript" type="text/javascript"
src="tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({....});
function myCustomExecCommandHandler(){...}
function customSave(id, content) {...}
</script>

However, my html textarea element, where tinyMCE object gets reference
to is invisible on thepage until user calls it to be visible with
display:block;. Therefore, I wanted to call the code above when it is
needed to initialize tinyMCE object. So I put javascript code into one
more remote file and call all two files upon request with similar
function:

function tinyMCEOnDemand(){
var head = document.getElementsByTagName("head")[0];
var script = document.createElement('script');
script.id = 'tinyMCEScriptInitializer';
script.type = 'text/javascript';
script.src = "tinyInit.js";
head.appendChild(script);
}

The problem is that tinyMCE is either undefined or does not have
properties (depends on which order of two requested files is used). I
do not know what exactly to ask but perhaps, you can share your idea
of how to initialize the object (tinyMCE) applied to an invisible
element or just any other thoughts?
Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top