how to check confirm password field in form without reloading page

后端 未结 15 1874
青春惊慌失措
青春惊慌失措 2020-12-12 13:58

I have a project in which I have to add a registration form and I want to to validate that the password and confirm fields are equal without clicking the register button.

15条回答
  •  余生分开走
    2020-12-12 14:21

    HTML CODE

            
    
            
    

    JS CODE

    function checkPass(){
             var pass  = document.getElementById("password").value;
             var rpass  = document.getElementById("rpassword").value;
            if(pass != rpass){
                document.getElementById("submit").disabled = true;
                $('.missmatch').html("Entered Password is not matching!! Try Again");
            }else{
                $('.missmatch').html("");
                document.getElementById("submit").disabled = false;
            }
    }
    

提交回复
热议问题