the problem with integrating jquery into submit form

the problem with integrating jquery into submit form

Hi!

I have a login form with set defaultValues. I want to mistakes jump out when the login and password are empty or when they are default. But that does not work. I tried this and that, but got troubled. The mistakes should jump out in ids "login_err" and "pass_err".
 Please help.

My form:

  1. <div id="login">
  2.          <form method="post" style="background:inherit">
  3.          <table style="align:right;text-align:right;margin:0 auto;">
  4.          <tr>
  5.          <td id="login_err"></td>
  6.          </tr>
  7.          </table>
  8.          <input id="login_name" name="login" type="text" value='Логин' onfocus= "if(this.value == 'Логин') { this.value = '' }"   onblur = "if(this.value == '') { this.value = 'Логин'}" > </br>
  9.          <table>
  10.          <tr>
  11.          <td id="pass_err"></td>
  12.          </tr>
  13.          </table>
  14.          <input id="pass" type="password" name="password" value="Пароль" onfocus= "if(this.value == 'Пароль') { this.value = '' }"   onblur = "if(this.value == '') { this.value = 'Пароль'}"></br>
  15.          <input type="submit" id="log" value="войти">
  16.         <a href="registration.html"> <input type="button" value="регистрация"></a>
  17.         </form>
  18. </div>
     
Jquery code:

  1. $(function(){
  2.  
  3.    $("#log").submit(function(){
  4.         var evt= e||window.event;
  5.         evt.preventDefault();
  6.        var hasError = false;
  7.       
  8.       var login=$("#login_name").val();
  9.       if (login=="" || login=="defaultValue")
  10.       {
  11.           $("#login_err").html("You forgot to enter login");
  12.           hasError=true;
  13.       }
  14.       var password=$("#pass").val();
  15.       if (password=="" || password=="defaultValue")
  16.       {
  17.           $("#pass_err").html("You forgot to enter password");
  18.           hasError=true;
  19.       }
  20.      
  21.       if(hasError == false) {
  22.         $(this).hide();
  23.         $("#log").before('<img src="ajax-loader.gif" alt="Loading" id="loading" />');
  24.         $.ajax ({
  25.             type: "POST",
  26.             url: "sendemail.php",
  27.             data: $("form").serialize(),
  28.             success: function(data) {
  29.            
  30.                  document.location.href = "paymentfinal.html";
  31.             }
  32.         });
  33.        }     
  34.    return false;
  35.    });
  36.   
  37. });