title: "Uncaught TypeError: Cannot read property 'length' of null JAVASCRIPT
body: <p>I am using simple length function to check length greater than zero based on id. Code i am using is</p>
  
  <pre><code>if ($('#abcd').length &gt; 0)
  {
      var abcd = $('#abcd').val();
  }
  </code></pre>
  
  <p>This code is working fine and producing no error. But if i am using simple javascript in this way</p>
  
  <pre><code>if (document.getElementById('abcd').length &gt; 0)
  {
      var abcd = document.getElementById('abcd').val();
  }
  </code></pre>
  
  <p>Then it is not working and producing this error "Uncaught TypeError: Cannot read property 'length' of null". What does this error mean and how can i get this working ?</p>