Different behavior of blur event in different browsers
问题 Consider this example where I have 2 input fields: <input id="a" /> <input id="b" style="display: none" /> And consider the following JavaScript, which is an attempt to do this: Show #b only when #a has focus and hide #b whenever #a loses focus, except when #a loses its focus to #b . $("#a").focus(function() { $("#b").show(); }); $("#a, #b").blur(function() { $("#b").hide(); }); $("#b").focus(function(){ $("#b").show(); }); $("#a").focus(function() { $("#b").show(); }); $("#a, #b").blur