<div class="someClass">someClass</div> <div>Test</div> <script> document.body.onclick = function (e) { var el = e ? e.target : window.event.srcElement; if (el.className === "someClass") return; alert("No someClass className"); } </script>