document.getElementById('checkout-form').addEventListener('submit', function(event) {
// Prevent the form from submitting if the 'I'm not a robot' checkbox is not checked
const captchaChecked = document.getElementById('captcha-check').checked;
const captchaError = document.getElementById('captcha-error');
if (!captchaChecked) {
event.preventDefault(); // Stop the form from submitting
captchaError.style.display = 'block'; // Show error message
} else {
captchaError.style.display = 'none'; // Hide error message
alert('Order placed successfully!');
// You can add further form submission logic here (e.g., sending data to a server)
}
});
function placeOrder() {
// Trigger form submission to run the validation check
document.getElementById('checkout-form').dispatchEvent(new Event('submit'));
}