我已将CKEditor打开到我的文本区域。每当我尝试继续输入其中的文本时,CKEditor都会返回[object Object]而不是任何内容。
我该怎么办,我会错过什么?请帮助菜鸟
使用过的$('#area-answer').val(CKEDITOR.instances["area-answer"].getData())
结构
答案 0 :(得分:1)
$(document).ready(function () {
CKEDITOR.replace('area');
});
function submition() {
var areaText = CKEDITOR.instances['area'].getData();
alert(areaText);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="https://openconcept.ca/sites/all/libraries/ckeditor/ckeditor.js"></script>
<link rel="stylesheet" href="https://raw.githubusercontent.com/kevee/quail/master/examples/common/style.css">
<form method="post">
<!-- same strings-->
<textarea id="area" ></textarea>
<input type="button" value="Save" onclick="submition();" />
</form>
答案 1 :(得分:0)
尝试使用html()而不是val();
答案 2 :(得分:0)
HTML
<textarea id="my-editor">
<input id="send" type="button" value="Send">
JS for CKEditor
$('#send').click(function() {
var value = CKEDITOR.instances['DOM-ID-HERE'].getData()
// send your ajax request with value
// profit!
});