Skip to content

Commit 6e7a240

Browse files
committed
Repeat Password Validation
1 parent 8fbe08c commit 6e7a240

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

repeatPassword.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//Variables
2+
var password = document.getElementById("psw");
3+
4+
var confirm_password = document.getElementById("pswRepeat");
5+
6+
// Data Processing
7+
8+
function validatePassword(){
9+
if(password.value != confirm_password.value) {
10+
confirm_password.setCustomValidity("Passwords Don't Match");
11+
} else {
12+
confirm_password.setCustomValidity('');
13+
}
14+
}
15+
16+
password.onchange = validatePassword;
17+
confirm_password.onkeyup = validatePassword;

0 commit comments

Comments
 (0)