bootstrapValidator Method to Re Enable Submit Button
- 2021-07-22 08:35:50
- OfStack
In the use of bootstrapValidator, the submit button is invalid due to field checking and other reasons. How do I re-enable the Submit button?
The following code can enable the submit button:
$('#loginForm').bootstrapValidator('disableSubmitButtons', false);
Here's a look at the best way to disable the button after clicking in Bootstrap
To prevent multiple submissions by clicking a button in Bootstrap, you want to disable the button after clicking it.
The specific implementation method is as follows:
// Disable button
$('button').addClass('disabled'); // Disables visually
$('button').prop('disabled', true); // Disables visually + functionally
// Disable type is button Adj. input Button
$('input[type=button]').addClass('disabled'); // Disables visually
$('input[type=button]').prop('disabled', true); // Disables visually + functionally
// Disable hyperlinks
$('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 for seconds after it is clicked
function timer(time) {
var btn = $("#sendButton");
btn.attr("disabled", true); // Button is forbidden to click
btn.val(time <= 0 ? " Send dynamic password " : ("" + (time) + " Can be sent in seconds "));
var hander = setInterval(function() {
if (time <= 0) {
clearInterval(hander); // Clear countdown
btn.val(" Send dynamic password ");
btn.attr("disabled", false);
return false;
}else {
btn.val("" + (time--) + " Can be sent in seconds ");
}
}, 1000);
}
// Invoke method
timer(30);
The above is the site to introduce you to bootstrapValidator to re-enable the Submit button method, I hope to help you, if you have any questions welcome to leave me a message, this site will reply to you in time!