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

175
Views
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 answers
Answer question

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 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!