[英]ckeditor set textarea value
I can't get the correct value from the textarea 我无法从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. 我正在使用JSON请求将其发送到服务器,并且
$_POST['cmscontent']
值始终保持为空。 Is there something else I have to do? 我还有其他事要做吗?
You need to call editor.updateElement()
before you send AJAX request saving content. 在发送AJAX请求保存内容之前,您需要调用
editor.updateElement()
。 This method will update the textarea element with contents of the editor. 此方法将使用编辑器的内容更新textarea元素。
You can get the editor
instance from CKEDITOR.replace()
or from instances object - CKEDITOR.instances.cmscontent
. 您可以从
CKEDITOR.replace()
或实例对象CKEDITOR.instances.cmscontent
获取editor
实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.