title: jQuery focus() and empty field
body: <p>I want to empty a login field when it is selected. I'm working with a JS/jQuery-Book and copied the example exactly like this into my document but it doesnt want to work...</p>
  
  <p>Field:</p>
  
  <pre><code>&lt;input type="text" id="username" value="Username" name="username" /&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>$(document).ready(function(){
  $("#username").focus(function(){
      var field = $(this);
      if(field.val() == field.attr("defaultValue")){
      field.val(""); // also tried field.val() = "";
      }
  });
  });
  </code></pre>
  
  <p>I already put an alert() after each line and I figured out that it doesnt go into the if-statement.</p>