SoFunction
Updated on 2025-03-03

bootstrapValidator How to re-enable the submit button

When bootstrapValidator is used, the submit button is invalid due to field checking and other reasons. How to re-enable the submit button?

The following code can enable the submission button:

$('#loginForm').bootstrapValidator('disableSubmitButtons', false); 

Let's take a look at the best way to disable the button after clicking in Bootstrap

To prevent multiple submissions from clicking buttons in Bootstrap, I hope to disable the button after clicking the button.

The specific implementation method is as follows:

//Disable button$('button').addClass('disabled'); // Disables visually
$('button').prop('disabled', true); // Disables visually + functionally
//Disable input button of type button$('input[type=button]').addClass('disabled'); // Disables visually
$('input[type=button]').prop('disabled', true); // Disables visually + functionally
//Disable hyperlink$('a').addClass('disabled'); // Disables visually
$('a').prop('disabled', true); // Does nothing
$('a').attr('disabled', 'disabled'); // Disables visually

Just write the above method into the click event, such as:

$(".btn-check").click(function () {
      $('button').addClass('disabled'); // Disables visually
$('button').prop('disabled', true); // Disables visually + functionally
    });

The js button is not available within a few seconds after clicking

function timer(time) {
 var btn = $("#sendButton");
 ("disabled", true); //Press button is not allowed (time <= 0 ? "Send dynamic password" : ("" + (time) + "Send in seconds"));
 var hander = setInterval(function() {
 if (time <= 0) {
  clearInterval(hander); //Clear the countdown  ("Send dynamic password");
  ("disabled", false);
  return false;
 }else {
  ("" + (time--) + "Send in seconds");
 }
 }, 1000);
}
//Calling methodtimer(30);

The above shows the method of re-enablement of the submit button by bootstrapValidator introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message. The editor will reply to you in time!