ZaZaKi, a web developer Between Manchester UK & Rotterdam NL. © 2015-2024.

JavaScript confirm OK and Cancel

 <button onclick="confirmYesAndCandel()">Confirm Yes or Cancel ?</button>

<p id="demo"></p>

<script>

function confirmYesAndCandel() {
  var txt;
  if (confirm("Press OK or Cancel!")) {
    txt = "You pressed OK!";
  } else {
    txt = "You pressed Cancel!";
  }
  document.getElementById("demo").innerHTML = txt;
}

</script>
Categroy:
Front-end , javascripts