title: Javascript, getElementById and style not working: Uncaught TypeError: Cannot read property 'style' of null
body: <p>I have this code here:</p>
  
  <pre><code>document.getElementById('success').style.display("block");
  document.getElementById('success').text("aaaa"); 
  </code></pre>
  
  <p>and I get this error, why?</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'style' of null 
  
  &lt;span id="success" style="color:#FFF; display:none;"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>I moved my code to bottom of the page and I get this new error now</p>
  
  <p><code>Uncaught TypeError: Property 'display' of object #&lt;CSSStyleDeclaration&gt; is not a function</code></p>