Skip to content

Instantly share code, notes, and snippets.

@aimahdi
Created August 15, 2021 06:01
Show Gist options
  • Save aimahdi/f716baa2bd1ea8b88715272ecf1a422a to your computer and use it in GitHub Desktop.
Save aimahdi/f716baa2bd1ea8b88715272ecf1a422a to your computer and use it in GitHub Desktop.
The code will make second passwords field's text red until the password matched
//Change id with your password field's id
let passwordOne = document.getElementById("ff_143_password");
let passwordTwo = document.getElementById("ff_143_password_again");
passwordTwo.addEventListener('keyup', function(){
let passwordTwo = document.getElementById("ff_143_password_again");
console.log(passwordTwo.value);
//code here
if(passwordTwo.value==passwordOne.value){
passwordTwo.style.color = 'blue';
}else{
passwordTwo.style.color = 'red';
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment