如何在使用ajax提交后清除ckeditor表单?

ser*_*g66 10 forms ajax jquery ckeditor

我正在使用CKeditor,Jquery和插件jquery形式.

CKEDITOR.replace( 'comment-textarea' );
function CKupdate(){
    for ( instance in CKEDITOR.instances )
        CKEDITOR.instances[instance].updateElement();
}

$(document).ready(function(){   
    var options = {
        success: function (html) {
            $('#comments').append(html);
        },
        clearForm: true 
    };

    $('#formcomments').submit(function() {
        CKupdate();
    });
    $('#formcomments').ajaxForm(options);
});   
Run Code Online (Sandbox Code Playgroud)

我正在使用clearForm:true,但在提交表单后,textarea Ckeditor的值不会被清除.如何清除textarea ckeditor?

ser*_*g66 31

谢谢大家,我使用函数setData,一切正常:

function CKupdate(){
    for ( instance in CKEDITOR.instances ){
        CKEDITOR.instances[instance].updateElement();
        CKEDITOR.instances[instance].setData('');
    }
}

$(document).ready(function(){   
    CKEDITOR.replace( 'comment-textarea' );

    var options = {
        success: function (html) {
            $('#comments').append(html);
        },
        clearForm: true 
    };

    $('#formcomments').submit(function() {
        CKupdate();
    });
    $('#formcomments').ajaxForm(options);
}); 
Run Code Online (Sandbox Code Playgroud)