yaragallamurali Posted April 30, 2014 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? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 30, 2014 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. Link to comment Share on other sites More sharing options...
yaragallamurali Posted April 30, 2014 Author 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. Link to comment Share on other sites More sharing options...
yaragallamurali Posted April 30, 2014 Author Share Posted April 30, 2014 I got a rough idea. thank you so much. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now