从WYSIWYG CKEditor传递textarea值
问题描述:
我正在尝试将我在WYSIWYG编辑器(CK编辑器)中创建的输入传递给JQuery。目前,无论我输入什么,它都是空白的。
I'm trying to pass the input I made in a WYSIWYG editor (CK Editor) to JQuery. Currently it's blank no matter what I input.
HTML:
<textarea type='text' class="ckeditor reply" name='reply'></textarea>
<button type="button" STYLE="align: right;" class="btn btn-info reply_button yGreenButton">Submit Reply</button>
JS:
<script>
$(function()
{
$('.reply_button').click(function(){
var reply=$(this).siblings('.reply').val();
});
});
</script>
textarea显示为CKeditor。点击reply_button时提醒的当前值是空白的,无论我放入CKeditor textarea。如何获取我输入的实际内容以提醒?
The textarea shows up as CKeditor. The current value alerted from the clicking the reply_button is blank, no matter what I put in the CKeditor textarea. How to get the actual content I input to be alerted?
非常感谢建议。
最佳,
答
这是一个CKEditor,你必须使用他们的API:
It's a CKEditor, you have to use their API:
var editor = CKEDITOR.replace( '.ckeditor' );
editor.getData();
可以找到API文档这里。