jQuery hide div on focus out unless certain div is clicked -


i have div popped list of items type text box.

on blur of textbox hide list of items.

however, have click events on items no longer trigger because focusout event fires first.

what want hide list on blur unless item in list has been clicked.

does know of way?

it should work same tags section of site when asking question.

with jquery 1.6 or higher can use :focus selector see if div has children have focus before hiding div.

$("#textboxid").blur(function () {     if ($("#divid").has(":focus").length == 0) {  //if click on other results         $("#divid").hide();  //hide results     } }); 

update: turns out worked in ie. here better solution, though little complex task. http://jsfiddle.net/cb2cn/

var resultsselected = false; $("#resultsdiv").hover(     function () { resultsselected = true; },     function () { resultsselected = false; } );  $("#textbox").blur(function () {     if (!resultsselected) {  //if click on other results         $("#resultsdiv").hide();  //hide results     } }); 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -