Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
validar la contraseña de la entrada del usuario después de hacer clic en el botón Enviar

Quiero que verifique si el usuario ingresó el formato correcto para la contraseña (que es al menos una minúscula, una mayúscula, un número, ocho o más caracteres y un carácter especial), pero no pude validarla.

JS:

 var Pass = document.getElementById('password'); function validatePassword() { if (Pass.value.match(/^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{8,}$/)) { document.getElementById('pass').innerHTML = 'Invalid password. Please follow the format.'; return false; } }
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

agregar más expresión ayudará. para comprobar la mayúscula y las letras minúsculas. Además, para verificar la contraseña, necesita algún tipo de botón para usarlo como disparador para llamar a la función.

o puede usar el detector de eventos "oninput".

 var Pass = document.getElementById('password'); // lets say your validator button hase id of validate; let validator=document.getElementById("validate"); validator.onclick=validatePassword(Pass.value); // or use on input method like Pass.oninput=validatePassword(Pass.value); function validatePassword(value) { let reg=/^(?=.*[0-9])(?=.*[!@#$%^&*])(?=.*[az])(?=.*[AZ])[a-zA-Z0-9!@#$%^&*]{8,}$/; if (!reg.test(value) { Pass.innerHTML = 'Invalid password. Please follow the format.'; return false; } return true; }
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!