79244561

Date: 2024-12-02 15:10:28
Score: 0.5
Natty:
Report link

It's pure javascript (which is compatible with jquery) but there is a javascript confirm("prompt?") function that does a pop-up user query with 'OK' and 'Cancel' buttons.

Example below slightly edited from W3Schools: https://www.w3schools.com/jsref/met_win_confirm.asp

W3Schools try it: https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_confirm3

<button onclick="myFunction()">Try it</button>

<p id="rslt"></p>
<script>
function myFunction() {
  let prompt = "Press a button!\nEither OK or Cancel.";
  let text= 'uninit'
  if (confirm(prompt) == true) {
    text = "You pressed OK!";
  } else {
    text = "You canceled!";
  }
  document.getElementById("rslt").innerHTML = text;
}
</script>

https://jsfiddle.net/5byx2w4s/1/ (with a little more edits)

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: john v kumpf