jquery-focusout

Make focusout event ignore some elements

不问归期 提交于 2019-12-11 10:21:54
问题 In the code below if you click on <input type="text" id="one" /> and a "red block" appears . If you focus out then the "red block" disappears . How do I make it so that focusout wont fire if "red block" or <input type="text" id="two" /> are the next focused elements? Demo JavaScript $('#one').focus(function () { $('#divRemove').show(); }); $('#one').focusout(function () { $('#divRemove').hide(); }); $('#divRemove').click(function(){ alert($(this).text()); }); HTML <input type="text" id="one"