2 <%=Html.TextAreaFor(Model => Model.WORK_INTRODUCTION)%>
3 <script type="text/javascript">
4 CKEDITOR.replace('WORK_INTRODUCTION');
5 </script>
1、擷取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、擷取CKEditor純文字
var CText=CKEDITOR.instances.WORK_INTRODUCTION.document.getBody().getText(); //取得純文字
3、擷取CKEditor帶HTML标簽的文本
var CHtml= CKEDITOR.instances.WORK_INTRODUCTION.getData();
4、給CKEditor指派
CKEDITOR.instances.WORK_INTRODUCTION.setData("要顯示的文字内容");
參考文獻:http://banu.blog.163.com/blog/static/2314648201282553627350/
http://blog.csdn.net/limlimlim/article/details/17113197
轉載于:https://www.cnblogs.com/landiljy/p/5410242.html