Jq's validate plug-in verifies why the error box is always there when the form loses focus.

problem description

jq"s validate plug-in verifies why the error box is always there when the form loses focus

the environmental background of the problems and what methods you have tried

onfocusout: function(element) { 
        $(element).valid(); 
    }, 

currently using this doesn"t work. The problem encountered is multiple conditional judgments in a form
password: 1. First of all, it cannot be empty 2. There are also 8-16 alphanumeric characters
when the input of my password gains focus and loses focus, input is not filled in. If it is empty, it is required. But when I get the focus information again, there will be an error prompt that the password is not in the correct format instead of when I lose focus.

related codes

/ / Please paste the code text below (do not replace the code with pictures)

 <div class="shuru-password">
    <div class="content">
        <form action="" class="form" id="form">
            <div class="title"><span></span><a href=""></a></div>
            <div class="wire"></div>
            <h3></h3>
            <ul>
                <li><span class="lock"></span><input type="password" placeholder="8-16" name="password" id="password"></li>
                <li><span class="lock"></span><input type="password" placeholder="" name="confirm_password" id="confirm_password"></li>
                <li>
                    <span class="pen"></span><input type="text"  placeholder="" style="width: 260px;" name="code" id="code">
                    <a href=""><img src="" alt="" style="width: 100px; height: 40px; margin-left: 15px;display: inline-block"></a>
                </li>
            </ul>
            <div class="next"><button class="next-a bg-orange" id="registerform" type="submit"></button></div>
        </form>
    </div>
</div>

<script>
$("-sharpform").validate({
    onfocusout: function(element) { 
        $(element).valid(); 
    }, 
    submitHandler: function(form){  
        form.submit();   
    },
    rules:{
        password:{
            required:true,
              password:true
        },
        confirm_password:{
            required:true,
            equalTo:"-sharppassword"
        },
        code:{
            required:true
        }
    }
})

</script>

what result do you expect? What is the error message actually seen?

my goal is to prompt an error message when you lose focus


ask for advice, online, etc.

Menu