2009-12-16 43 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

感谢您的答复。其实,我做了一些'捅'与萤火虫,并找不到任何