📌  相关文章
📜  自定义 jquery 验证消息 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:47.098000             🧑  作者: Mango

代码示例1
var validator = $("#signupform").validate({
    rules: {
        firstname: "required",
        lastname: "required",
        username: {
            required: true,
            minlength: 2,
            remote: "users.php"
        }
    },
    messages: {
        firstname: "Enter your firstname",
        lastname: "Enter your lastname",
        username: {
            required: "Enter a username",
            minlength: jQuery.format("Enter at least {0} characters"),
            remote: jQuery.format("{0} is already in use")
        }
    }
});