title: If text box empty, display alert box
body: <p>I am very new to coding and just trying to learn how to make a simple validation, to check if text box is filled in or not, but it never seems to work for me... This is my code:</p>
  
  <p>Html:</p>
  
  <pre><code>Username:&lt;br/&gt;
      &lt;input type="text" placeholder="Username" id="uname"&gt;
      &lt;input type="submit" id="check" value="OK" onclick="check()"&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>//IF TEXT BOX EMPTY, DISPLAY ALERT MESSAGE.
  function check(){
      var uname=document.getElementById(uname).value;
      if (uname==""){
          alert("Username is obligatory")
      }
  }
  </code></pre>