javascript confirm cancel do nothing

 

 

 

 

This function in turn calls the javascript confirm() function. When I say cancel the confirm function returns false and nothing should happen.I now take a decision to open a new window for the url passed to the script function in the function if the user chooses to proceed else I do nothing. Cancel events. In this chapter you will learn: How to use preventDefault to cancel events. In this scenario, use JavaScript built-in function confirm(). The confirm() function displays a popup message to the user with two buttons, OK and Cancel. SCENARIO: I just want to warn user on window change so Ive used jQuerys window blur JavaScripts confirm dialogue box. When user will click OK button the application will redirect to another page when user will click CANCEL button nothing will happen. When the JavaScript confirm() function is triggered, a small box will pop up and display an "OK" button and a " Cancel" button (along with text that you specify in your JavaScript code). The JavaScript confirm alert box differs from a regular alert box in that it provides two choices for the user, OK and Cancel.