Article

Implement Confirmation Dialog Box Using Javascript

01 Mar 2018 Kamal Pratap
0 Comments 890 Views



Sometimes we need to display confirmation dialog box to perform any task. Here we explain how to use confirmation popup using java script on button event.

 

It is a right way to display a alert message before doing any activity.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Confirmation Dialog Box Using Javascript</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <script type="text/javascript">
            function ConfirmationBox() {
                var Yes = confirm("User want's to continue..?");
                var check = new Boolean(Yes);
                if (check == true) {
                    alert('want to continue Yes');
                    return true;
                }
                else {
                    alert('user dont continue');
                    return false;
                }
            }  
        </script>
        <div>
            <input type="button" value="Click Me" onclick="ConfirmationBox();" />
        </div>
    </div>
    </form>
</body>

 

Kamal Pratap

I have 6+ years experience in .Net technologies like Asp.Net, C#, WCF, Web Services, SQL Server, Ajax, LinQ. Currently I am working in Netcarrots Loyalty Services as a Software Developer.

Comments

No coments found to display!

Leave a Comment