Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
Can you create a basic password validation form that redirects to another page if the password is correct?

I'm still gripping the ropes of HTML, and I was wondering if you could create a basic form that checks if the entered item is correct, then do something like send an alert or redirect to another page. I already know how to create redirects and alerts but I'm just having trouble with the password part. Thanks in advance.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Unfortunately with the nature of JavaScript the password will always be able to obtained from the source code, unless you link it with a backend API Request.

But here is a very simple example with the password opensesame.

function submitHandler(event) {
  const formData = new FormData(event.target);
  const password = "opensesame";
  if (formData.get("password") === password) {
    alert("You're In!");
  }
  event.preventDefault();
  return false;
}

const form = document.getElementById("form");
form.addEventListener("submit", submitHandler);
<form id="form">
  <label>Password: <input name="password" type="password"></label>
  <br><br>
  <button type="submit">Submit form</button>
</form>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda