title: Adding error message to an input field with JavaScript?
body: <p>I'm having trouble displaying an error message in my form using JavaScript. </p>
  
  <p>Here is part of my form and the input field that I'm trying to access with JS. I'd like to add the error message underneath inside the span tags.</p>
  
  <pre><code>&lt;form name="subform" id="subform" action="submit.php" onsubmit="return checkForBlank()" method="POST" enctype="multipart/form-data"&gt;
  
      &lt;div class="md-form"&gt;
          &lt;input type="text" id="subcim" name="subcim" class="form-control"&gt;
          &lt;label for="subcim" class=""&gt;Title&lt;/label&gt;
      &lt;/div&gt;
      &lt;span class="error_form" id="subcim_error_message"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>Here is my JavaScript code:</p>
  
  <pre><code>function checkForBlank() {
  if(document.geElementById("subcim").value == "") {
      document.getElementById("subcim_error_message").textContent="You must add a title!";
      return false;
  }
  }
  </code></pre>
  
  <p>So basically the error message should appear when the input field is left empty. But it's not shown. </p>
  
  <p>Any help is appreciated.</p>