I've turned on CKEditor to my textarea. Every time, when I try to proceed typed text in it, CKEditor returns [object Object] instead of any content.
What should I do and what could I missed? Please, help to noob
Used $('#area-answer').val(CKEDITOR.instances["area-answer"].getData())
construction
$(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>
尝试使用html()而不是val();
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!
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.