js获取CKEditor内容

来源:互联网 发布:网络维护企业名录 编辑:程序博客网 时间:2024/05/16 17:05

1、获取CKEditor被选中的内容

var mySelection = CKEDITOR.instances.ckStem.getSelection();

        if (CKEDITOR.env.ie) {
            mySelection.unlock(true);
            data = mySelection.getNative().createRange().text;
        } else {
            data = mySelection.getNative();

        }

2、获取CKEditor纯文本

 var stemTxt=CKEDITOR.instances.CKEditor1.document.getBody().getText(); //取得纯文本       

3、获取CKEditor带HTML标签的文本

var stem = CKEDITOR.instances.CKEditor1.getData();

原创粉丝点击