div に 2 つの入力ボックスがあります。入力の focusOut でその div を非表示にしたいのですが、両方にフォーカスがない場合に限ります。
これは Firefox の一般的な問題 (標準に準拠していると言う人もいます) ですが、ドキュメントの本文がその間でフォーカスを奪います。
HTML
<div id="baz">
<input type="text" id="foo" name="foo" />
<input type="text" id="bar" name="bar" />
</div>
jQuery
// jQuery Example
jQuery(":input").focusout(function(){
// Don't do anything if one of the input boxes has focus
if( jQuery(":input").is( jQuery(document.activeElement) ){ return; }
// Hide the container if one of the inputs loose focus
jQuery(this).parents("div").css("display","none");
}
これはよくあるバグですが、過去にどのように解決したか忘れてしまいました。activeElement
. _