title: How to add a loading gif when submitting a form
body: <p>None of the current questions asked about this topic seem to help me, I am fairly new to this and I need some help. Currently I have a form, and on submit (currently do not have any validation) it shows a hidden div using this function.</p>
  
  <pre><code>function showDiv() {
  document.getElementById('showme').style.display = "block";
  }
  </code></pre>
  
  <p>I would like to add a loading gif,  that shows for around 2 seconds after clicking the button and then carries on to show the hidden div.
  My form is as shown -</p>
  
  <pre><code>&lt;form action="" method="POST" id="hello" onsubmit="showDiv(); return false;"&gt;
  </code></pre>
  
  <p>The button to log in is here</p>
  
  <pre><code>&lt;input class="btn_green_white_innerfade btn_medium" type="submit" name="submit" id="Login" value="Sign in" width="104" height="25" border="0" tabindex="5" onclick="showDiv()"&gt;
  </code></pre>