how to check confirm password field in form without reloading page

后端 未结 15 1849
青春惊慌失措
青春惊慌失措 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:35

    $box = $('input[name=showPassword]');
    
    $box.focus(function(){
        if ($(this).is(':checked')) {
            $('input[name=pswd]').attr('type', 'password');    
        } else {
            $('input[name=pswd]').attr('type', 'text');
        }
    })
    

提交回复
热议问题