title: Hide div when clicking outside
body: <p>I've searched and search not only google but also here and still have to find a solution that will work.</p>
  
  <p>I have a div that is hidden by default, then toggled by clicking on a link. I also want it to hide when you click outside of the div. Simple, I thought, but nothing I've tried had worked yet.</p>
  
  <p>This is the jquery:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function toggleDiv(divID) {
      $("#"+divID).fadeToggle(200);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>And the link that toggles it:</p>
  
  <pre><code>&lt;a onclick="toggleDiv('myDiv');"&gt;Link&lt;/a&gt;
  </code></pre>
  
  <p>And then the div:</p>
  
  <pre><code>&lt;div id="myDiv"&gt;
  stuff
  &lt;/div&gt;
  </code></pre>
  
  <p>If anyone has any advice, I would really appreciate it.</p>