title: Why can't I edit the style property with JavaScript?
body: <p>So, I was just trying to make a <code>&lt;div&gt;</code> appear on an onkeyup event with javascript and for some reason, it didn't let me do it and I got the error: </p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'style' of null</p>
  </blockquote>
  
  <p>This is my code: </p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="content" id="content" style="display: none"&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>function showContent() {
      document.getElementById('content').style.display = 'block';
  }
  </code></pre>
  
  <p>Can you please help? Thanks.</p>