2015-11-18 87 views
2

我有一個CKEditor的textarea的:如何閱讀文本區域價值CKEditor的軌道4,5

<textarea id='notification_message' name='notification[message]'> 

我只是想通過下面的代碼讀取的CKEditor textarea的值:

var message = $("textarea[name='notification[message]']").val(); 
    alert(message); 

但它給了我空白的價值。我怎麼能得到ckeditor textarea的值?

+0

你可能有興趣在[jQuery的適配器(http://docs.ckeditor.com/#!/guide/dev_jquery),使用這個你可以使用' $('textarea.editor')。val();'正常。 –

+1

[使用JavaScript獲取ckeditor textarea的textarea值]可能的副本(http://stackoverflow.com/questions/7906085/getting-the-textarea-value-of-a-ckeditor-textarea-with-javascript) – webster

回答

3

嘗試像下面

var value = CKEDITOR.instances['notification_message'].getData();