You're probably looking for confirm(), which displays a prompt and returns true or false based on what the user decided: if (confirm('Are you sure you want to. The confirm() method displays a dialog box with a specified message, along with an OK and a Cancel button. A confirm box confirm(), Yes, Yes, Yes, Yes, Yes. No, using alerts, prompts and confirms are considered disruptive to the user and should be avoided unless you are using them to test. If you want.