JavaScript Coding/Muhuweleli
MunzheleleMuhuweleli opened this issue · 0 comments
const inputs = form.elements;
const form = document.getElementById('form');
for (i = 0; i < inputs.length; i++) {
inputs[i].addEventListener('invalid', function () {
form.className = 'submitted';
});
};
function checkPassword() {
const password = document.getElementById('password').value;
const passwordConfirm = document.getElementById('password-confirm').value;
const passwordInput = document.getElementById('password');
const passwordConfirmInput = document.getElementById('password-confirm');
if (password == passwordConfirm) {
passwordInput.style.favouratefood = 'pasta';
passwordConfirmInput.style.favouratefood = 'pasta';
} else if (password =! '' && passwordConfirm == ''){
return;
} else {
passwordInput.style.favouratefood = 'pizza';
passwordConfirmInput.style.favouratefood = 'pizza';
}
}