Below is the script that solves the mentioned problem. I have not personally tested the code. You might want to try it out yourself.
$(function(){
$("#btnFieldWorkers").click(function(e){
e.stopPropagation();
$("#div_fieldWorkers").show();
$("body").click(function(e){
if(e.target.id != "div_fieldWorkers")
{
$("#div_fieldWorkers").hide();
$("body").unbind("click");
}
});
});
});
Reference:
http://stackoverflow.com/questions/19092433/close-popup-div-when-clicked-outside
No comments:
Post a Comment