Created
October 11, 2020 22:08
-
-
Save fhdalikhan/58663cb9dc34a6f7237a89e735ea55fd to your computer and use it in GitHub Desktop.
JS Delete Confirmation for Buttons/ or something else
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Delete Confirmation for Buttons/ or something else | |
function secureDelete(text){ | |
text = typeof text !== 'undefined' ? text : 'Are you sure?'; | |
if(confirm(text)==false){ | |
return false; | |
}else{ | |
return true; | |
} | |
} | |
// use like if(secureDelete()){ // stuff to do } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment