title: How to make fadeOut effect with pure JavaScript
body: <p>I'm trying to make fade out effect for a <code>div</code> with <em><strong>pure JavaScript</strong></em>.</p>
  <p>This is what I'm currently using:</p>
  <pre><code>//Imagine I want to fadeOut an element with id = &quot;target&quot;
  function fadeOutEffect()
  {
   var fadeTarget = document.getElementById(&quot;target&quot;);
   var fadeEffect = setInterval(function() {
    if (fadeTarget.style.opacity &lt; 0.1)
    {
     clearInterval(fadeEffect);
    }
    else
    {
     fadeTarget.style.opacity -= 0.1;
    }
   }, 200);
  }
  </code></pre>
  <p>The div should fade out smoothly, but it immediately disappears.</p>
  <p>What's wrong? How can I solve it?</p>
  <p><a href="http://www.jsbin.com/kepaho/1/edit" rel="noreferrer">jsbin</a></p>