2021-1-6 21:23:54 jquery-3.3.1.js:4978 Uncaught TypeError: Cannot create property ‘guid‘ on boolean

**jquery-3.3.1.js:4978 Uncaught TypeError: Cannot create property ‘guid’ on boolean ‘true’**错误

As the name implies, you
cannot add attribute guid on boolean true

Stupid again

When the binding event calls the method, it is convenient to add () after the method name, java sequelae. .
error

			$("#username").blur(cheackUsername());
            $("#password").blur(cheakPassword());
            $("#email").blur(cheakEmail());
            $("#name").blur(chaekName());

correct

			$("#username").blur(cheackUsername);
            $("#password").blur(cheakPassword);
            $("#email").blur(cheakEmail);
            $("#name").blur(chaekName);

Even if it is js, please pay attention to the effective range of the variable, do not conflict.
The following is the variable name without correction when copy and paste

//校验用户名
        function cheackUsername() {
    
    
            console.log("校验用户名格式方法被执行");
            var username = $("#username").val();
            var reg_uesrname=/^\w{8,20}$/;
            var usernameflag = reg_uesrname.test(username);
            if(usernameflag){
    
    
                $("#username").css("border","")
            }else {
    
    
                $("#username").css("border","1px solid red")
            }

Guess you like

Origin blog.csdn.net/m0_49194578/article/details/112298212