Im using bPopUp to show a hidden div that is working well. This bPopup is triggered by a DDL when an item is selected. Now, I want to reset my DDL to value 0 when the user clicked outside of popUp.
PS: Im able to close my popUp, unless I click for two times on html page I cant able to capture that click event.
$("html").click(function () {
if ($('#bPopup').is(":visible")) {
$('#ddl').val('0');
}
});
$(document).mouseup(function (e) {
var container = $(your container selector);
if (!container.is(e.target) // if the target of the click isn't the container...
&&
container.has(e.target).length === 0) // ... nor a descendant of the container
{
container.hide();
}
});
try this code