我怎样才能获得用户的输入,这是一种输出或编码的方法吗?
现在我能做的是
var content = $('#cke_ckeditor1 iframe').contents().find('.cke_show_borders').clone();
我怎样才能获得用户的输入,这是一种输出或编码的方法吗?
现在我能做的是
var content = $('#cke_ckeditor1 iframe').contents().find('.cke_show_borders').clone();
有一种方法可以返回编辑器的内容editor.getData()
- 请参阅文档。
CKEDITOR.instances
您可以在对象中找到编辑器实例。
我使用了 itextsharp 的参考来使用 ckeditor。
在 html 中声明一个隐藏的文本字段
<%= Html.Hidden("EditECurrentComplainText")%>
在 div 中,我使用了 textArea 并将其转换为 ckeditor,然后将该 ckeditor 的值放入隐藏字段中。
<div id="EditECurrentComplain_ckEditor">
<%= Html.TextAreaFor(model => model.Current_Complain, new { rows = "10", id = "EditCurrent_ComplainCK" })%>
<%= Html.ValidationMessageFor(model => model.Current_Complain)%>
<% if (Model.Current_Complain != "")
{ %>
<script type="text/javascript">
jQuery(document).ready(function () {
CKEDITOR.replace('EditCurrent_ComplainCK');
});
</script>
<%} %>
</div>
使用以下语句将 ckeditor 的内容获取到隐藏的文本字段中
$("#EditECurrentComplainText").val(CKEDITOR.instances["EditCurrent_ComplainCK"].getData());
最后使用这个隐藏文本字段内容作为我想要的输出/输入。
谢谢。