Sweet Alert 2 - “confirmButtonText”按钮中的链接

问题描述 投票:0回答:2

我想知道如何在按钮中放置一个链接,生成confirmButtonTextSweet Alert 2

目标是,当您按下该按钮重定向到从数据库中删除记录的页面时,直到现在我在一个简单的按钮中使用简单的链接(<a>),但我想添加这个小的确认。

这是代码:

按钮如下:

php html sweetalert sweetalert2
2个回答
1
投票

你可以使用有希望的甜蜜警报2

Swal.fire({
 title: 'Are you sure?',
 text: "You won't be able to revert this!",
 type: 'warning',
 showCancelButton: true,
 confirmButtonColor: '#3085d6',
 cancelButtonColor: '#d33',
 confirmButtonText: 'Yes, delete it!'
}).then((result) => {
  if (result.value) {
  Swal.fire(
   'Deleted!',
   'Your file has been deleted.',
   'success'
 )
}
})

更重要的是,检查:https://sweetalert2.github.io/


1
投票

这会奏效!

confirmButtonText: '<a href="url">LINK</a>'
© www.soinside.com 2019 - 2024. All rights reserved.