...

View Full Version : Need help figuring out logic



Keleth
03-13-2012, 09:37 PM
I was going through LinkedIn today, when I noticed something that I couldn't figure out, logic-wise.

When you search using their search feature at top left, results come up live... no big deal, easy enough, keyup, no biggie. When you click outside the input box, it disappears, which is blur. However, if you click out of the input onto the search results, it remains, and stays up until you click somewhere outside of the input box or the search results. This I have no idea how is done.

Is there a way to know what element a user clicks on? Anyone have thoughts/guidance for this? I'm using jQuery as a framework if that helps?

devnull69
03-14-2012, 08:32 AM
Of course there is ... see example code here: http://jsbin.com/eculim

Basically you can register a click handler on document level, then check e.target to exclude certain target elements, otherwise hide the textbox and/or result list



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum