CKeditor的取值和赋值

<script type="text/javascript">
     var myeditor=CKEDITOR.replace('txtContent', { toolbar: 'Basic' });
</script>

即赋值给一个变量就OK了,然后使用下面的方式读取文本域的值:

myeditor.document.getBody().getText(); //取文本形式的值
myeditor.document.getBody().getHtml(); //取包含html代码的值

如果要赋值那么就是

myeditor.setData("需要赋值的内容");

猜你喜欢

转载自conkeyn.iteye.com/blog/2382989