简体   繁体   中英

How to detect tinyMCE textarea blur/focusout event?

I am working on existing project. When I click some editable text on webpage, it becomes textarea and tinyMCE tool bar appears. When I click outside that textarea then toolbar disappears. I want to get that event when textarea lost focus and want to submit the form automatically.

I am unable to capture that focusout event. Only mouseout event is working but it is not good because as we move outside textarea, form is submitted and page is refreshed each time.

$('.module-container form').live("mouseout", function() { // blur/focusout not working here. even ".module-container form textarea" selector not working
    alert('outside');
});

So how to capture tinyMCE textarea focusout event. Any Idea ?

Thanks

Try:

tinyMCE.dom.Event.add(tinyMCE.getInstanceById("editor-id").getWin(), "blur", function(){
    // Blur operations
});

An easy approach is

$(ed.getDoc()).bind("blur", function(e){
    // do whatever you like here
}, true);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM