<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div>123</div>
<script>
var div = document.getElementsByTagName('div')[0];
document.addEventListener('click', function(e) {
var target = e.target;
if(target == div) return;
div.style.display = "none";
});
</script>
</body>
</html>