javascript - jQuery focusout not triggering on exit of input element -
i'd fire focusout event no matter click on document. i'm using sortable list each sortable item contains textarea, focusout event isn't fired when clicking on sortable items. same occurs draggable items. have created jsfiddle showcase issue:
click on textarea , attempt click anywhere within blue rectangle: tested in google chrome http://jsfiddle.net/rwjhs/
are there known workarounds?
javascript:
$("textarea").focusout(function(){ alert("do something"); }); $("#draggable").draggable();
html:
<div id="draggable"> <textarea></textarea> </div>
you may try this
$("textarea").focusout(function(){ alert("do something"); }).click(function(e){ e.stoppropagation(); return true; }); $("#draggable").draggable({ start: function( event, ui ) { if( $('textarea:focus', this).length ){ $('textarea', this).focusout(); } } }).click(function(e){ if( $('textarea:focus', this).length ){ $('textarea', this).focusout(); } });
Comments
Post a Comment