2011-07-14 50 views
3

我目前正在使用ckeditor,並且我正在使用該編輯器的jquery插件來實例化文檔準備就緒時的所有內容。我需要做的是爲正在創建的ckeditor實例設置模糊事件。下面的代碼是我用來實例化ckeditor的。ckeditor jquery插件和模糊事件

$(「textarea.editor」)。ckeditor();

我試圖做的是一樣的東西:

$( 「textarea.editor」)模糊()。

有沒有辦法做到這一點與ckeditor使用jquery插件呢?

回答

8

您需要將您的處理程序綁定到編輯器實例而不是textarea本身。這結合了上模糊處理程序到你的編輯器實例:

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 [email protected])

+0

這個答案被接受爲正確的。 – ujjaval