Answers for "confirm return in js"

1

javascript window confirm

// window.confirm opens a confirmation box with two buttons; 'Ok' or 'Cancel'
window.confirm("Message");
// window.confirm returns a boolean, true or false, based on whether the user pressed 'Ok' (which will result in true) or 'Cancel' (which will result in false)
if (window.confirm("Message")) {
  console.log("'Ok' was pressed");
} else {
  console.log("'Cancel' was pressed");
}
Posted by: Guest on December-16-2021
2

confirm javascript

if (window.confirm("Une nouvelle fenêtre va s'ouvrir.")) {
    window.open("fenetre.html", "Nouvelle fenêtre", "");
}
Posted by: Guest on January-14-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language