Skip to content

Instantly share code, notes, and snippets.

@tanzilhuda
Last active May 6, 2018 19:06
Show Gist options
  • Save tanzilhuda/a9cf85652634372cd8794c70cfcb1daf to your computer and use it in GitHub Desktop.
Save tanzilhuda/a9cf85652634372cd8794c70cfcb1daf to your computer and use it in GitHub Desktop.
Delete Button Warning
onclick="return confirm('are you sure to delete!')"
For Bootbox js
==============
CND:
https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js
html:
id="delete"
Example:
<a id="delete" href="#"><button class="btn btn-outline-danger">Delete</button></a>
Script:
<script>
$(document).on("click", "#delete", function(e) {
var link = $(this).attr("href"); // "get" the intended link in a var
e.preventDefault();
bootbox.confirm("Are you sure?", function(result) {
if (result) {
document.location.href = link; // if result, "set" the document location
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment