如何禁用 bootstrap 确认点击监听器?
How to disable bootstrap confirmation click listener?
我正在使用 javascript 启用确认 (http://bootstrap-confirmation.js.org/),如下所示:
$ (className).confirmation ({...})
当我单击带有给定 className
的 dom 时,它将触发确认对话框。请问如何通过javascript去掉这个点击事件?
您所要做的就是使用来自 bootstrap 的 built-in method 确认
$('#element').confirmation('hide');
片段
$('[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>
我正在使用 javascript 启用确认 (http://bootstrap-confirmation.js.org/),如下所示:
$ (className).confirmation ({...})
当我单击带有给定 className
的 dom 时,它将触发确认对话框。请问如何通过javascript去掉这个点击事件?
您所要做的就是使用来自 bootstrap 的 built-in method 确认
$('#element').confirmation('hide');
片段
$('[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>