title: jQuery Input Text Clear, Return to Default no Entry
body: <p>I'm currently using inline javascript to clear an input text's default value on focus. If the user does not enter anything, the default value is shown once blurred. Code as follows:</p>
  
  <pre><code>onfocus="if(this.value==this.defaultValue) this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;"
  </code></pre>
  
  <p>The problem lies in the fact that I have to add this snippet to every single text input throughout the site. What would the jQuery equivalent of this be that would automatically do this for every text input (:text).</p>
  
  <p>I have concocted the following with two errors. (1) It clears any value that the text field may have. I only want it to clear it if the value is the default attr value. (2) The blur function does not insert the default value. I'm missing something incredibly simple I'm quite sure.</p>
  
  <pre><code>$(':text').focus(function() {
              var value = $(this).val();
              var defval = $(this).attr('value');
              if(value == defval) {
                  $(this).val('');
              }
          });
          $(':text').blur(function() {
              var value = $(this).val();
              var defval = $(this).attr('value');
              if(value == '') {
                  $(this).val(defval);
              }
          });
  </code></pre>
  
  <p>Thanks in advance!</p>