div outside click event jquery 1

div outside click event jquery

$(document).click(function(){
 $("#try").hide(); 
});

$("#try").click(function(e){
  e.stopPropagation(); 
});

Here is what the above code is Doing:
1. When the user clicks on the input field, the dropdown is shown.
2. When the user clicks anywhere else on the page, the dropdown is hidden.
3. When the user clicks on the dropdown, the dropdown is not hidden.

Similar Posts