How can I achieve this?
If yes is selected, the link continues as clicked, but if cancel is selected, the action is canceled.
Update: Final working code with confirm()
thanks to this guy:
$('.confirm').click(function() {
return confirm("Are you sure you want to delete this?");
});
Javascript provides a builtin confirmation dialog.
if (confirm("Are you sure?"))
{
// continue with delete
}
in my experience this is the best and easiest way to have a confirmation!
<a href="#" onclick="return myconfirm()">Confirm</a> <script> function myconfirm() { if(confirm('Are You Sure ...')) return true; return false; } </script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With