1var proceed = confirm("Are you sure you want to proceed?");
2if (proceed) {
3 //proceed
4} else {
5 //don't proceed
6}
1// The confirm function is used to display a dialog with ok and cancel. Usage:
2
3var content = confirm("Hello"); // The "hello" means to show the following text
4if (content === true) {
5 // Do whatever if the user clicked ok.
6} else {
7 // Do whatever if the user clicks cancel.
8}
9
10// You can also use window.confirm()
1$("#complexConfirm").confirm({
2 title:"Delete confirmation",
3 text:"This is very dangerous, you shouldn't do it! Are you really really sure?",
4 confirm: function(button) {
5 alert("You just confirmed.");
6 },
7 cancel: function(button) {
8 alert("You aborted the operation.");
9 },
10 confirmButton: "Yes I am",
11 cancelButton: "No"
12});
1if (window.confirm("Une nouvelle fenêtre va s'ouvrir.")) {
2 window.open("fenetre.html", "Nouvelle fenêtre", "");
3}