$.validator.setDefaults({
submitHandler: function() {
if ($("#username").val() != "" && $("#password").val() != "") {
form1.submit();
}
else {
if ($("#password").val() == "") {
$("#password").focus();
}
if ($("#username").val() == "") {
$("#username").focus();
}
}
}
});
This code can add custom jquery validation instead of relying solely on writing validation="{}" in the tag, or writing validation rules in code, which will all be in the Write an error message after the control to be verified.