I am using CK Editor in an app.
<textarea name="contentDetails" id="contentDetails" rows="10" cols="80"></textarea>
But I can't retrieve text from that textarea. I've tried-
var content= $("#contentDetails").text(); //and also .val() & .html()
But content
variable remains empty.
Any idea?
//UPDATE - add my codes below
<script>
CKEDITOR.replace('contentDetails');
$(function () {
$("#submitcontent").click(function (e) {
e.preventDefault();
var content= $("#contentDetails").text();
});
});
</script>
Use:
var text = CKEDITOR.instances.contentDetails.getData();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With