What's the best practice to code a suggestion list for a textbox?
Posted on 2010-08-16
The current situation is after the suggestion list show up with some suggested items. Users should be able to use the mouse to click the suggested item to select that item. However, I also set an onblur event for the textbox to dismiss the suggestion list, so when users click on any other areas on the page or tab out the textbox (I suppose either action means the user is done with the textbox), the suggestion list will go away.
The problem in this case is if users want to click one of the suggested items, the onblur event will be triggered first, so the suggestion list will be dismissed first before the click event is triggered. Is there some way to trigger the click event before the suggestion list is dismissed?