Implement Confirmation Dialog Box Using Javascript
01 Mar 2018
Kamal Pratap
Comments
2560
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>