开发者

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

开发者 https://www.devze.com 2022-12-13 02:53 出处:网络
I\'m developing an ajax heavy web app, and would like to have textarea\'s (with class=\"ui-richtext\") automatically initialize TinyMCE.

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

精彩评论

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