jquery-confirm - 如何将 href link 发送到浏览器

jquery-confirm - How to send href link to browser

我正在使用这个不错的插件 jquery-confirm v3.0.3 (http://craftpip.github.io/jquery-confirm/) 来确认操作

但是当使用下面的代码时,我的 link 的 href 操作在我按下 OK 按钮时没有执行?

我做错了什么?感谢您的帮助...

<a class="delItem" href="?del=true&id=1">Supprimer</a>

$('a.delItem').confirm({
            title: 'Confirmer cette action',
            content: '',
            animation: 'left',
            theme: 'light',
            type: 'red',
            autoClose: 'cancel|10000',
            buttons: {
                confirm: {
                    text: 'OK'
                },
                cancel: {
                    text: 'Annuler',
                    action: function () {
                    //$.alert('action is canceled');
                    }
                }
            }
        });

您尝试添加

location.href = this.$target.attr('href');

在您的“确定”按钮中点赞

$('a.delItem').confirm({
  title: 'Confirmer cette action',
  content: '',
  animation: 'left',
  theme: 'light',
  type: 'red',
  autoClose: 'cancel|10000',
  buttons: {
    confirm: {
      text: 'OK',
      location.href = this.$target.attr('href')
    },
    cancel: {
      text: 'Annuler',
      action: function () {
        //$.alert('action is canceled');
      }
    }
  }
});

只需在 confirm 块内添加操作函数(如在取消时一样),并在其中:

window.location.href = $(this).attr("href");