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?

Now i need to hide the div when i click elsewhere on the document except on the dropdown. how can i achieve this?.

With some jQuery, you should be able to accomplish this. This isnt tested, but should give you the general idea...

$('html').click(function () {
     $("#div1").hide();
});

thank u. if there is any easy way with javascript please recommend.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.