1

I have a DIV and a Load button on my page and when I click in Load button the jQuery loads a HTML from another file, this HTML file have texteareas and start tinymce.

Ex:

<script language="Javascript">
function loadForm() {
    $("#myContent").load("HTMLFile");
}

function goback() {
    $("#myContent").load("Another HTML File Without TINYMCE");
}
</script>

<div id="myContent"></div>
<input type="button" value="Load" onclick="loadForm()"/>

HTMLFile:

<textarea id="myText" class="tinymce"></textarea>
<input type="button" value="Cancel" onclick="goback()"/>
<script language="Javascript">
$("textarea.tinymce").tinymce({
    // Configurations here
});
</script>

The problem: When I click in Load button on my page the tinyMCE works, but after this if I click in Cancel button and after in Load button again the tinyMCE don't load more, only in first time.

Any tips?

2
  • I'd suggest you have a good hard look at what happens to the code after you have loaded in the tinyMCE code. tinyMCE may modify its container or something along those lines, so use a tool like FireBug to see what's happening and go from there. Commented Nov 27, 2009 at 0:47
  • Ok, I'll try to find something with firebug. Commented Nov 27, 2009 at 0:54

1 Answer 1

2

I would suggest adding the callback function of the load method to initialize the tineMCE editor.

 function loadForm() {
    $("#myContent").load("HTMLFile", {}, function(){
        $("textarea.tinymce").tinymce({
            // Configurations here
         });

    });
 }

So the HTMLFile will NOT have any script.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.