Reputation: 11
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
Upvotes: 0
Views: 529
Reputation: 1
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!
});
Upvotes: 0
Reputation: 4557
$(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>
Upvotes: 1