-2

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?

dippas
  • 58,591
  • 15
  • 114
  • 126
Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523
  • I've never worked with it, took me 10 seconds to find in the documentation you linked to. http://bootstrap-confirmation.js.org/#methods – baao Jun 16 '18 at 11:11

1 Answers1

0

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>
dippas
  • 58,591
  • 15
  • 114
  • 126