title: default values in input fields getting past validation on submission
body: <p>I wrote a small validation script (partially as an exercise in learning) but I can't figure out how to make it detect default values in the input fields.  It seems like I need to store the default value in a variable and then add another OR in there to check if the current value matches that default value but I can't quite figure out how to do that.  I can't put the variable inside the function executed on the click because then it takes the value at that point and uses that.  Any help would be appreciated.  I thought about just using "placeholder" but I wanted to make it work in IE.  thanks in advance.</p>
  
  <pre><code>$('.submit').click(function() {
  var ret_val = true;
  var emailaddressVal = $("#email").val();
  var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
  $('.required').each(function(){
  if($(this).val().length === 0 || $(this).find("option:selected").val() == "none") 
  {
      $('#errormessage').removeClass('requiredmessage');
      ret_val = false;
      $(this).addClass('warning');
  }
  else if($(this).val().length != 0)
  {
      $(this).removeClass('warning');
  }
  });
  if(!emailReg.test(emailaddressVal))
  {
      $('#emailerrormessage').removeClass('requiredmessage');
      $('#email').addClass('warning');
      ret_val = false;
  }
  else
  {
      $('#emailerrormessage').addClass('requiredmessage');
  }
  return ret_val;
  });
  </code></pre>