yaragallamurali 2 Posted April 30, 2014 Report Share Posted April 30, 2014 Hi i have a textarea. Text area is to enter label names. When i enter first letter of the label name the matching labels appear as dropdown so that they can select the label from the drop down instead of typing the whole name. This drop down is a div. Now i need to hide the div when i click elsewhere on the document except on the dropdown. how can i achieve this? I tried with onblur on the textarea but there is a pronblem with that. the problem is when drop down appears there will be list of tags in the drop down. now i have to capture the clicked tag from drop down but as onblur is geting fired the drop down is getting hiden and onclick event on the labels is not working. In the drop down every label is a div. Thanks in advance for helping? Quote Link to post Share on other sites
justsomeguy 1,135 Posted April 30, 2014 Report Share Posted April 30, 2014 Put a click handler on the document or body, and inside the handler you can determine which element was clicked on. If it was not the text field, then hide the option list. Quote Link to post Share on other sites
yaragallamurali 2 Posted April 30, 2014 Author Report Share Posted April 30, 2014 Can u help me with the code of getting clicked element inside the handler. I will be so thankfull. I am struck at this point. Quote Link to post Share on other sites
yaragallamurali 2 Posted April 30, 2014 Author Report Share Posted April 30, 2014 I got a rough idea. thank you so much. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.