读取CKEditor的值(包括纯文本)

来源:互联网 发布:安芬尼.哈达威数据 编辑:程序博客网 时间:2024/05/22 14:02
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();
0 0
原创粉丝点击