CKEditor get the html text, plain text, the selected content and assignments

1, access to selected content CKEditor

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

2, get CKEditor plain text

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

3, CKEditor get the text with HTML tags

var CHtml= CKEDITOR.instances.WORK_INTRODUCTION.getData();

4, assigned to CKEditor

CKEDITOR.instances.WORK_INTRODUCTION.setData("要显示的文字内容");

Guess you like

Origin blog.csdn.net/qwe435541908/article/details/79409263