$.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.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn