Javascript – Automatically initialize rich text editor on top of all textarea’s, including ones that are loaded via ajax


I'm developing an ajax heavy web app, and would like to have textarea's (with class="ui-richtext") automatically initialize TinyMCE.

This is easy for textarea's that are loaded normally, but how about for content that is loaded AFTER the fact using ajax?

I was thinking something along these lines: (i'm using jquery)

$("textarea.ui-richtext").live("ajaxComplete", function()

Unfortunately this doesn't seem to work. Any ideas?

This is my first post, let me know if I need to add more info

Best Solution

Live is limited to a small number of events.

You can do something like this though:

    url: 'url/here',
    success: function(data){
        var $data = $(data).("textarea.ui-richtext").tinymce();
Related Question