2 <%=Html.TextAreaFor(Model => Model.WORK_INTRODUCTION)%> 3 <script type="text/javascript"> 4 CKEDITOR.replace('WORK_INTRODUCTION'); 5 </script>
一、獲取CKEditor被選中的內容
var mySelection = CKEDITOR.instances.WORK_INTRODUCTION.getSelection();
if (CKEDITOR.env.ie) {
mySelection.unlock(true);
data = mySelection.getNative().createRange().text;
} else {
data = mySelection.getNative();
}
二、獲取CKEditor純文本
var CText=CKEDITOR.instances.WORK_INTRODUCTION.document.getBody().getText(); //取得純文本
三、獲取CKEditor帶HTML標籤的文本
var CHtml= CKEDITOR.instances.WORK_INTRODUCTION.getData();javascript
四、給CKEditor賦值java
CKEDITOR.instances.WORK_INTRODUCTION.setData("要顯示的文字內容");spa
參考文獻:http://banu.blog.163.com/blog/static/2314648201282553627350/.net