我正在使用javascript启用确认(http://bootstrap-confirmation.js.org/),如下所示:
$(className).confirmation({...})
当我点击带有给定className
的dom时,它将触发确认对话框。我想知道如何通过javascript删除此点击事件?
答案 0 :(得分:0)
您所要做的就是使用引导确认中的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>