我想知道如何在按钮中放置一个链接,生成confirmButtonText
的Sweet Alert 2
。
目标是,当您按下该按钮重定向到从数据库中删除记录的页面时,直到现在我在一个简单的按钮中使用简单的链接(<a>
),但我想添加这个小的确认。
这是代码:
按钮如下:
你可以使用有希望的甜蜜警报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/
这会奏效!
confirmButtonText: '<a href="url">LINK</a>'