Try this:
$("body").click(function (e) {
var elt = $(e.target);
if (!($(e.target).attr("id") == "light") && !($(e.target).parents("div").attr("id")=="light"))
{
$("#light").hide();
}
});
Its depends on your conditions. Anyways I have edited my post, you can check now.