Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Need help figuring out logic
03-13-2012, 09:37 PM #1
- Join Date
- Jun 2008
- New Jersey
- Thanked 259 Times in 256 Posts
Need help figuring out logic
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?
03-14-2012, 08:32 AM #2
- Join Date
- Dec 2010
- Thanked 558 Times in 551 Posts
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