Confirm Dialog Boxes in Javascript  

The Javascript confirm alert dialog box differs from a regular alert dialog box in that it provides two choices to the user, OK and CANCEL. When you click the “OK” button it returns true otherwise it returns false.

0 725 Technology | Javascript
Wed Dec 26 , 2018

A confirm dialog box allows user to confirm or cancel an action. They alert you of potentially objectionable material. You can create confirm dialog boxes with the confirm() method.




<title>JavaScript Confirm Dialog Box</title>  
<script language="javascript"> 
function fn_confirm()
    var result = confirm("Click OK or Cancel to Continue");     
    if(result == true)  
        document.write("You clicked OK");  
        document.write("You clicked Cancel");  
<input type="button" value="Click Confirm Box" onClick='fn_confirm()'>



Subscribe & Get Regular Updates On Your E-mail