I have that code:
<td style="text-align: center"><a href='eliminar.php?id=<?php echo $crow['id'];?>'><i class="fa fa-trash" style="color: darkred" onclick="return confirmar()"></i></a></td>
and that script:
function confirmar(){
var respuesta = confirm("Esta seguro que desea eliminar esa entrada??");
if (respuesta == true){
return true;
}
else{
return false;
}
}
As this one works perfectly, but I wanted to implement the SweetAlert library and there is no way that works for me, I have already tried several ways and it does not work, it directly deletes the entry.
Someone who already uses SweetAlert that could help me implement it in my code?
From already thank you very much
There are many options:
But first you change your code
For something dynamic so that each click is just the ID of the post and not your href :
And you would have something like this with SweetAlert2: