How to disable bootstrap confirmation click listener?

832 views Asked by At

I am using javascript to enable confirmation (http://bootstrap-confirmation.js.org/) as below:

$ (className).confirmation ({...})

when I click the dom with the given className it will trigger the confirmation dialog. I wonder how I can remove this click event through javascript?

1

There are 1 answers

0
dippas On BEST ANSWER

All you have to do is use a built-in method from bootstrap confirmation

$('#element').confirmation('hide');

Snippet

$('[data-toggle=confirmation]').confirmation('hide');
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-confirmation2/dist/bootstrap-confirmation.min.js"></script>
<br />
<br />
<br />
<br />
<br />
<br />
<button class="btn btn-default" data-toggle="confirmation">Confirmation</button>