title: Check if an HTML input element is empty or has no value entered by user
body: <p>Related to <a href="https://stackoverflow.com/questions/154059/what-is-the-best-way-to-check-for-an-empty-string-in-javascript">this</a> question here. Can I check if an element in the DOM has a value or not? I'm trying to put it into an 'if' statement and not sure if my approach is correct. Here goes:</p>
  
  <pre><code>if (document.getElementById('customx')){
      //do something
  }
  </code></pre>
  
  <p>Or should it be:</p>
  
  <pre><code>if (document.getElementById('customx') == ""){
      //do something
  }
  </code></pre>
  
  <p>EDIT: By value I mean, <code>customx</code> is a text input box. How can I check if this field has no text entered.</p>