html Text editor not displayed in ajax form

I am using a Text Editor which will be displayed in a add form.I am loading the form through ajax.When i click the add button the add form will loaded in ajax.Now the problem is my HTML Text editors script files are not getting loaded in my ajax form.Simple text area alone displays. How to load the text editor in the ajax form,Please advice me.

This is the editor i am using

<script type='text/javascript'>   
    var j = jQuery.noConflict();
        j(function() {
                toolbar: ["html", "|",
                        "|", "bold", "italic", "underline", "|", "p", "h1", "h2", "h3", "|", "link", "unlink"] // Overrides/Specifies the Toolbar buttons to show

    <textarea id="Textarea1" cols="50" rows="15"><p><h3>Another TextArea</h3>This is some sample text to test out the <b>WYSIWYG Control</b>.</p></textarea>

Please try to load all the js files during Ajax load. Please also mention the type of html editor you are using like FCKEditor, Tiny MCE etc.

The js you use to create the editor is probably only getting loaded at run time. Move it to a function, call on ready and on ajax success.

No the function will not execute. If you want that to run the script you will need to call a function after your response to "eval" the script for you.

Your new function will need to find and execute the script in the DOM.

pseudo code below

//put your response in a div or something and use the div id to grab the tag with a name = to script

That will always happen with scripts loaded via AJAX into the document. To get around this you can do two things.

  1. Use DOM to get the AJAX response, and then append it to the head of the document so that it will be treated as a script.

  2. Use eval(). I discourage doing this, but some people don't care about using it, especially when the code is small.

What Others Are Reading