ckeditor add “keyup” event

喜欢而已 提交于 2019-12-10 18:46:29

问题


How can I attach "keyup" event to CKEdtior (I am using the jQuery adapter)

This is the code I am currently using:

$('#ckeditor textarea').ckeditor(function(editorInstance) {

    /* attaching "keyup" doesnt seem work so I have to stick with "key" */

    $('#ckeditor textarea').ckeditorGet().on('key', function(e) {
        /* do stuff ... */
    });

}, {
     skin : 'office2003'
});

The whole idea is to get the ckeditor content every time the content is changed. Hope someone can help here.

Thanks


回答1:


Ok, this seems to work for me.

$('#ckeditor textarea').ckeditor(function() {

    var editor = $('#ckeditor textarea').ckeditorGet();        

    editor.on('contentDom', function() {
        editor.document.on('keyup', function(event) {
        /* do stuff */
    });

}, {
    skin : 'office2003'
});


来源:https://stackoverflow.com/questions/11711364/ckeditor-add-keyup-event

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!