简体   繁体   中英

ckeditor set textarea value

I can't get the correct value from the textarea

<textarea class="ckeditor" name="cmscontent" id="cmscontent"></textarea>
<script type="text/javascript">
    CKEDITOR.replace('cmscontent');
</script>

I'm using a JSON request to send it to the server, and the $_POST['cmscontent'] value stays empty all the time. Is there something else I have to do?

You need to call editor.updateElement() before you send AJAX request saving content. This method will update the textarea element with contents of the editor.

You can get the editor instance from CKEDITOR.replace() or from instances object - CKEDITOR.instances.cmscontent .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM