---
title: "How to use confirmation box using JavaScript"  
description: "This is the simple demonstration in JavaScript how to use confirmation box. Confirmation box are used for check the user confirmation for example you"  
author: "Amit Singh"  
published: 2012-02-22  
updated: 2017-11-29  
canonical: https://www.mindstick.com/articles/875/how-to-use-confirmation-box-using-javascript  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# How to use confirmation box using JavaScript

This is the [simple](https://www.mindstick.com/blog/63525/get-the-most-out-of-maths-with-these-8-simple-tricks) demonstration in [JavaScript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript) how to use confirmation box. Confirmation box are used for [check](https://yourviews.mindstick.com/view/81033/coronavirus-does-not-check-religion) the [user](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) confirmation for example you want to [delete](https://www.mindstick.com/forum/34101/xceed-datagrid-with-insert-update-delete) this [item](https://www.mindstick.com/forum/156564/remove-item-in-an-array-in-javascript), you want to continue this [page](https://yourviews.mindstick.com/view/83591/the-complete-guide-page-speed-optimisation-and-seo) etc.\

So, this is the simple code how to use confirmation box.

##### Write this code on aspx page

```
<head runat="server">     <title>Sample for Confirmation Box</title>     <script type="text/javascript">         function FuncCheck() {            var strVal = confirm("Are you sure you want to show this content?");            if (strVal ==  true) {                return true;            }            else {                var lblMsg = document.getElementById('lblMsg');                lblMsg.innerHTML = "";                return false;            }         }     </script></head><body>     <form id="form1" runat="server">     <div>         <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClientClick="return FuncCheck()"            OnClick="btnSubmit_Click" />         <asp:Label ID="lblMsg" runat="server"></asp:Label>     </div>     </form></body>
```

And write this code at [code behind](https://www.mindstick.com/forum/2278/adding-user-controls-from-code-behind) page

```
protected void btnSubmit_Click(object sender, EventArgs e)    {         lblMsg.Text = "This is your content.....";    }
```

---

Original Source: https://www.mindstick.com/articles/875/how-to-use-confirmation-box-using-javascript

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
