I have a form with a few input fields. When a user clicks on an input field, a hidden div appears with some selections for that field, they can then choose an option, and this set as the field value.
Currently, the way the div gets hidden is when the user selects an option. This works fine, but what if a user does not want to select an option, the div won't be removed. So, my solution was to use a blur event on the input fields, which would hide their div element. That way, a user could tab through the form, seeing the hidden div, and hiding it when they leave that field. This works correctly as well.
The problem arises when they now DO want to click something from the div to be filled into the input. Because I have added a blur even, that even fires when the user is trying to click an option in the div, effectively hiding the div a slight second before the user clicks, therefor adding nothing to the input field.
What would be the best way to solve this problem? I would like to have the blur event to hide the div, but there needs to be some sort of exception when the user wants to click inside the div, that the blur event won't hide the div that they are trying to click into.
Thanks for the help.