JQuery Validation

JQuery Validation

Goodt Evening,
 
I am new to JQuery and I have been reading the docs and examples around the web. For some reason I am unable to get Validation working. I have some very basic code to validate 1 form field and I get no errors but it will not display an warning for a required field. When I hit submit with a blank user name filed it just submits and reloads the form.
 
My code is below
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE>Test</TITLE>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js"></script>
<script type="text/javascript"src="http://ajax.microsoft.com/ajax/jQuery.Validate/1.6/jQuery.Validate.min.js"</script>
<script type="text/javascript" src="../java/frmregister.js"></script>
</HEAD>






 <BODY>
<form method="post" action="" id ="frmregister">
<label for="username">Choose a username</label>
<input type="text" name="username" id="username" value="" />
<label for="username" generated="true" class="error"></label>
<BR>
<BR>
<input type="submit" value="Submit" />
<input type="submit" value="Cancel" class="cancel" />
</form>
 </BODY>
</HTML>










 
 
 
$("#frmregister").validate({
  rules: {
    username: {
      required: true,
      minLength: 2
    }
  },
  messages: {
    username: {
      required: "Enter your username",
      minLength: "At least 2 characters are necessary"
    }
  },
});