I want to display a dialog box when my customer click "Place Order" on checkout page for last confirmation. I added following code
footer.php
<script type="text/javascript">
function lastConfirm() {
var r = confirm("Are you sure?");
if( r == true){
return true;
} else {
return false;
}
}
</script>
and I added onsubmit="lastConfirm()" inside form tag like below
form-checkout.php
<form name="checkout" method="post" class="checkout woocommerce-checkout" enctype="multipart/form-data" onsubmit="return lastConfirm()">
The dialog box pops up when I click "Place Order", but the order will be processed anyway whether I choose "OK" or "Cancel".
I want the order processed only when I click "OK". How could I accomplish this?
EDIT - The working answer form me is:
<form method="post" onsubmit="return lastConfirm()">
I just needed to remove some (well...most) attributes.