ckeditor jquery plugin and the blur event

北城以北 提交于 2019-12-13 14:34:39

问题


I'm currently working with ckeditor and i'm using the jquery plugin for this editor for instantiating everything when the document is ready. What I need to do is setup a blur event for the instance of ckeditor that is being created. The below code is what I'm using to instantiate ckeditor.

$("textarea.editor").ckeditor();

What I'm trying to do is something like:

$("textarea.editor").blur();

Is there a way to do this with ckeditor using the jquery plugin for it?


回答1:


You need to bind your handler to the editor instance not to the textarea itself. This binds an on-blur-handler to your editor instance:

var editor = CKEDITOR.instances['your_textarea_id'];

if (editor) {
    editor.on('blur', function(event) {
        // Do something, Example: disable toolbar:
        $("#cke_top_" + event.editor.name).css("display", "none");
    });
}   

(Inspired by skunkwerk@cksource-forum.)



来源:https://stackoverflow.com/questions/6700586/ckeditor-jquery-plugin-and-the-blur-event

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