gpt4 book ai didi

jquery - 我可以在点击事件 html 中使用 Bootstrap 框( Bootstrap 弹出窗口)吗?

转载 作者:行者123 更新时间:2023-12-01 06:33:05 26 4
gpt4 key购买 nike

我必须问你是否真的要删除所选项目,我想使用 bootbox....这不起作用!

<s:a onclick="return bootbox.confirm('Are you sure?')" action="deleteElement">

最佳答案

To the person, who voted to close this, I don't understand what's unclear about this, as the question is super-clear, OP is not using the right syntax. The bootbox.confirm() or whatever, expects a callback function and this doesn't work in the traditional way.

您必须使用callback function为此:

$(function () {
$("a").click(function (e) {
e.preventDefault();
bootbox.confirm('Do you really wanna delete?', function (res) {
if (res)
location.href = 'http://www.example.com/';
});
});
});
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js"></script>

<a href="http://www.example.com/" action="deleteElement" class="btn btn-danger">Delete</a>

关于jquery - 我可以在点击事件 html 中使用 Bootstrap 框( Bootstrap 弹出窗口)吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34613776/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com