小编Lyn*_*eri的帖子

Bootstrap Modal - 如果单击 Yes 按钮,如何返回 True - 自定义确认

好的,我已经花了一整天的时间阅读问答,但仍然无法完成。我需要创建一个自定义的确认(),而不是默认对话框,如果用户单击是,我使用引导模式返回真,否则返回假。

例子:

<a href="remove.php?id=3" onclick="return custom_confirm('Are you sure you want to remove this?');" />

我的自定义确认功能是:

function custom_confirm(message) {
  //  put message into the body of modal
  $('#modal-custom-confirmation').on('show.bs.modal', function (event) {
  //  store current modal reference
    var modal = $(this);

    //  update modal body help text
    modal.find('.modal-body #modal-help-text').text(message);
  });

  //  show modal ringer custom confirmation
  $('#modal-custom-confirmation').modal('show');

  //  if Yes button is clicked, return true
  //  if No  button is clicked,  return false
  //  logic here...
}
Run Code Online (Sandbox Code Playgroud)

我的模态在这里:

<!--  modal: custom confirmation …
Run Code Online (Sandbox Code Playgroud)

javascript jquery bootstrap-modal

6
推荐指数
2
解决办法
1万
查看次数

在NetBeans中编写Java:如何一次重命名变量的所有出现?

我正在使用NetBeans IDE编写Java代码.如何一次重命名变量的所有出现?

java netbeans

2
推荐指数
1
解决办法
2998
查看次数

标签 统计

bootstrap-modal ×1

java ×1

javascript ×1

jquery ×1

netbeans ×1