Action Duplicated - Is there any way to disable button after the first click?
Author: thiagossnetCreated Dec 14, 2020Updated Mar 22, 2024
When I click that button repeatedly, it performs the same action repeatedly. Does anyone know a way to disable the confirmation button after the first click?
My code is:
$('#btn-execute-procedure').on('click', function(e) {
e.preventDefault();
swal({
title: "Are you sure?",
text: "Confirm this",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Confirm!",
cancelButtonText: "Cancel!",
closeOnConfirm: false,
closeOnCancel: true
}, function(isConfirm){
if (isConfirm) {
$('#execute-form').submit();
}
});
Source: t4t5/sweetalert