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
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 divId.getElementsByTagName("script") loop... eval(script.innerHTML)
That will always happen with scripts loaded via AJAX into the document. To get around this you can do two things.
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.
Use eval(). I discourage doing this, but some people don't care about using it, especially when the code is small.