开发者

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()
{
    $(this).tinymce({...});
});

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

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


Live is limited to a small number of events.

You can do something like this though:

$.ajax({
    url: 'url/here',
    success: function(data){
        var $data = $(data).("textarea.ui-richtext").tinymce();
        $('#mydiv').append($data);
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜