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

194
Vistas
Cómo vincular dos botones en html

Tengo un archivo HTML que tiene dos secciones. Una sección tiene un formulario dentro de ella. Y el otro tiene un mensaje. Si el usuario envía el formulario, aparece un mensaje y habrá otro botón que el usuario debe presionar para completar el envío.

¿Hay alguna forma de vincular un botón para que el usuario tenga que presionar el otro botón para completar el trabajo del botón original?

 <section> <form> <input>... <button> // User presses the first submit button </button> </form> </section> <div> <button> // User has to press this button next inorder to complete the form </button> <div>

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

0

const form = document.querySelector("form"); // First grab the form const btn2 = document.getElementById("button2"); // Second button, make sure to add the id or any other proper selector let isSubmitted = false; // Once form will be submitted from inside // we will prevent the default behaviour of it so it does not do anything other than // marking isSubmitted as true, so this can be checked in other actions form.addEventListener("submit", (e) => { e.preventDefault(); isSubmitted = true; }); // Once the form is submitted once, only then // trigger programmatically the actual behaviour btn2.addEventListener("click", () => { if (isSubmitted) { form.submit(); } });

De esta forma, también puede jugar con la variable isSubmitted y volver a marcarla como falsa cada vez que alguien realice una acción que requiera una confirmación adicional del propio formulario.

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