2009-12-16 42 views
0

我試圖檢測用戶何時離開tinyMCE編輯器窗口,但我無法這樣做。這是我認爲應該工作(但是,這不是)代碼:TinyMCE:檢測onLeave()

$('.mceEditor').blur(function(){ 
    // I would expect this to fire when the user leaves the 
    // tinyMCE editor, but it never seems to fire 
}); 

我也試過:

$('*') 
    .not('.mceEditor, .mceEditor *') 
    .click(function(){ 
     // I would expect this to fire when anything but the tinyMCE editor 
     // has been clicked, but it seems to fire at every click 
    }); 

無論方法工作,我一直在這幾個小時。任何幫助都會大大降低。

感謝, 西蒙

PS:我使用jQuery插件版本,在這裏找到: http://tinymce.moxiecode.com/examples/example_23.php

回答

0

貌似TinyMCE的被插在一個iframe。在這種情況下,你將不得不訪問iframe的DOM,像這樣的東西可能會工作。

$("#content_ifr").contents().find('#tinymce'); 

其中content_ifr是iframe的ID,#tinymce似乎是包含內容的標記。使用螢火蟲和捅周圍看看。

+0

感謝您的答覆。其實,我做了一些'捅'與螢火蟲,並找不到任何