title: Trying to fill input field when user clicks away outside of input in jquery
body: <p>I am quite new to jquery so sorry if this is basic.</p>
  
  <p>I currently has a function that empties the value of a username input field so the user doesn't have to  delete it before entering their username.</p>
  
  <pre><code>   $("#usernameInput").click(function(){
          $(this).val("");
      });
  </code></pre>
  
  <p>But I am stuck trying to refill the input field with "username" if the user hasn't entered anything in the input field once they when the click outside of the input field after having clicked in it and clearing it with the previous function.</p>
  
  <p>This is what I have tried so far:</p>
  
  <pre><code>$("html").click(function(){
      if( $("usernameInput").val() == " " ){
          $("usernameInput").val("username");
      }
      else{
          //do nothing as user has entered username
      }
  
  
  });
  </code></pre>
  
  <p>Thanks</p>