我已经将CKeditor应用到了表单上的文本区域,但是在序列化表单之后,我检查了它没有从该字段中获取数据(描述)
我在CKEditor的文档中找到了这一点:

CKEDITOR.instances.description.updateElement();
alert(document.getElementById( 'description' ).value);


我需要通过API将数据发送到某个地方,但是如果没有alert(),它将无法正常工作。
我想将这些数据抓取到一个像

var a = document.getElementById( 'description' ).value;


但它只能使用alert()起作用:

var a = alert(document.getElementById( 'description' ).value);


但是我不想要那个alert()。我只是不想向用户显示其外观怪异的HTML代码。
感谢您的帮助。

最佳答案

在序列化之前,将原始textarea值设置为ckeditor的值:

$("#OriginalTextAreaId").val(CKEDITOR.instances.description.getData());

10-05 20:37
查看更多