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

251
Vistas
jQuery: delay disable button onclick after the form submission?

So right now I have this:

HTML:

<input type="submit" class="usp-submit usp-submit-default"  onclick="return change(this); "  id="btnSubmit" />

jQuery:

function change( el )

{
    if ( el.value === "Send" )
        el.value = "Sending";
    else
        el.value = "Please wait...";

$("#btnSubmit").attr("disabled", true);
    
}

This does disable the input button and change the value to "Please wait", but the form is not submitted.

I assume this disables the button in the first place and doesn't perform the send action.

I have read somewhere that you can add a delay before .attr("disabled", true) for a few milliseconds so that the form would be submitted first.

Any help from jQuery experts would be appreciated.

Thanks.

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

0

If you want to delay, you can use the vanilla js way, setTimeout()

function change( el )
{
    if ( el.value === "Send" )
        el.value = "Sending";
    else
        el.value = "Please wait...";

    setTimeout( () => $("#btnSubmit").prop("disabled", true) , 0);
}
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