Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

match password and confirm password in javascript if true then submit form

function onChange() {
  const password = document.querySelector('input[name=password]');
  const confirm = document.querySelector('input[name=confirm]');
  if (confirm.value === password.value) {
    confirm.setCustomValidity('');
  } else {
    confirm.setCustomValidity('Passwords do not match');
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #match #password #confirm #password #javascript #true #submit #form
ADD COMMENT
Topic
Name
5+9 =