title: Javascript: Click anywhere in body except the one element inside it
body: <p>I want to be able to click anywhere inside the body except that one specific element. I can't find out what's wrong with the code I have done. </p>
  
  <p>When I click on the one specific element <code>.except</code> inside <code>body</code>, I don't want it to hide but when I click on <code>body</code> it should hide. </p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Click anywhere except that specific element&lt;/title&gt;
    &lt;/head&gt;
    &lt;body id="wrapper"&gt;
      &lt;center&gt;
        &lt;div id="except"&gt;&lt;/div&gt;
      &lt;/center&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <pre><code>var body = document.getElementById('wrapper');
  var except = document.getElementById('except');
  
  if(body.addEventListener)
    body.addEventListener("click", function(){bodyClick("yes")}, false);
  else
    body.attachEvent("onclick", bodyClick);
  
  function bodyClick(clicked){
  
    except.addEventListener("click", exceptClick,false);
    function exceptClick(){
      bodyClick("no");
      if(clicked === "yes")
        except.style.display = "none";
    }
  
    if(clicked === "yes")
      except.style.display = "none";
    else
      except.style.display = "show";
  
  }
  </code></pre>
  
  <p>Any help is appreciated. Forgive me for the incorrect formatting (it's my first post here). Thank You!</p>