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
<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"
}
},
});