deleting textarea values from a form

deleting textarea values from a form

Hello,

I have a simple, three-field form that I am setting default values from within my jquery script. When a user clicks on a field the default values are removed, leaving that field blank for the user to type into.

The form accepts the default values from my jQuery script just fine. And when I click on the "to" and "from" fields, the default text is, in fact, removed. The problem is when I click on the textarea, the default value does not get removed.

Any thoughts?


Here is my html:
  1. <form class="blogForm" name="blogForm">
  2.     <Input class="blogFormTo" type="text" name="email" />
  3.     <Input class="blogFormFrom" type="text" name="email" />
  4.     <textarea class="blogFormNote"></textarea>
  5. </form>



And my jquery:
  1. $(document).ready(function()
  2. {
  3. // clear form field values on click

  4. // set default values
  5. $(".blogFormTo").val("To: (Separate multiple addresses with commas)");
  6. $(".blogFormFrom").val("From: (Enter email address)");
  7. $(".blogFormNote").val("Add a personal message");
  8. // clear the "to" field if value is default
  9. $(".blogFormTo",this).click(function()
  10. {
  11. if (this.value=="To: (Separate multiple addresses with commas)")
  12. {
  13. this.value = "";
  14. }
  15. });

  16. // clear the "from" field if value is default
  17. $(".blogFormFrom",this).click(function()
  18. {
  19. if (this.value=="From: (Enter email address)")
  20. {
  21. this.value = "";
  22. }
  23. });
  24. // clear the "text" field if value is default
  25. $(".blogFormNote",this).click(function()
  26. {
  27. if (this.value == "Add a personal message")
  28. {
  29. $(this).value = "";
  30. }
  31. });
  32. });
Thanks!
nucklebone