I have a popup that is similar to a 'google suggest' where it creates a drop-down based on the text after each onkeyup... There will be multiple fields like this on a page.
I'm struggling with hiding the popup if the user clicks outside the input box or tabs to the next field. I really want to use onblur, which seems to be designed exactly for this - except when I use it, it hides the popup when you click on a selection in the popup box - prior to it executing the script to put the value in the input box. If it could execute the clicked on action, then hide the box, it would work perfectly.
I'm trying to avoid using the 'find the mouse cursor click and determine if it is inside or outside the popup...' method. With that method I also have to take into account if they tab outside the input box.
The solution most people would do is add logic to your hide function that sees what element the event fired in and see if it is the child of the wrapper. Also your code is not keyboard accessible so you are limiting your audience to having to use a mouse.