var hasFocus = !! ($elem.find(':focus').length > 0);
Detecting child focus with focusout
jQuery event, setTimeout
is required to wait for next element in the DOM to receive focus:
$focusElem.on('focusout', function() { var $elem = $(this); setTimeout(function() { var hasFocus = !! ($elem.find(':focus').length > 0); if (! hasFocus) { // Handle blur here. } }, 10); });