无法从CKEditor访问文本 [英] Can't access text from CKEditor

查看:213
本文介绍了无法从CKEditor访问文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有此文本区域

<textarea name="description" id="description"></textarea>



JS



JS

CKEDITOR.replace( 'description' );
CKEDITOR.config.contentsCss = [CKEDITOR.getUrl('contents.css'), 
CKEDITOR.getUrl('/js/ckeditor/skins/moono-dark/styles.css')];

我这样做

$('textarea[name="description"]').keyup(function() {
    console.log($('textarea[name="description"]').val());
});

我在控制台上看不到任何东西。

I see nothing on my console.

有人可以告诉我如何进一步调试吗?

Can someone show me how to debug this further?

推荐答案

要接收事件并访问文本区域的更新内容,必须使用CKEDITOR对象,如下所示:

To receive events and access the updated content of the textarea you must use the CKEDITOR object like this :

CKEDITOR.instances.description.on('change', function() { 
    console.log(CKEDITOR.instances.description.getData());
});

这篇关于无法从CKEditor访问文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆