Create passwordconfirm.js
This commit is contained in:
17
assets/js/passwordconfirm.js
Normal file
17
assets/js/passwordconfirm.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const passwordInput = document.getElementById('password');
|
||||
const confirmPasswordInput = document.getElementById('confirm_password');
|
||||
const passwordError = document.getElementById('passwordError');
|
||||
const submitBtn = document.getElementById('submitBtn');
|
||||
|
||||
function validatePasswords() {
|
||||
if (passwordInput.value !== confirmPasswordInput.value) {
|
||||
passwordError.textContent = 'Passwords do not match.';
|
||||
submitBtn.disabled = true;
|
||||
} else {
|
||||
passwordError.textContent = '';
|
||||
submitBtn.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
passwordInput.addEventListener('input', validatePasswords);
|
||||
confirmPasswordInput.addEventListener('input', validatePasswords);
|
||||
Reference in New Issue
Block a user