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

176
Vistas
Submit button not get re-enabled

I have a Rails form, to which I have attached a submit handler which has a try / catch block and in the catch block, I display error message to the user and try to re-enable the submit button.

The button for some reason does not get re-enabled.

If I execute the same code in browser console later, the button gets re-enabled.

below is the relevant part of the code


function displayError(action,err){
  jQuery('input[name=commit]').removeAttr('disabled');
};

form.addEventListener('submit', (event) => {
try {

} catch(e) {
displayError('submit', e);
}
});

Any help on this will be really great, Thanks.

*** Update 1


if i console.log(jQuery('input[name=commit]')); I see this

enter image description here

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

0

YOu can use JQuery to enable and disable buttons in a UI. Assume the id of the button is

id="singlebutton"

Using JQuery, you can disable this button via this code:

$('#singlebutton').prop("disabled", true);

This disables the button.

enter image description here

Likewise to enable it, use:

  $('#singlebutton').prop("disabled", false);
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