Book any event coverage package lasting more than 4 hours to get this discount
Book any event coverage package lasting more than 4 hours to get this discount
document.addEventListener('DOMContentLoaded', function() {
// Select all buttons that should trigger the coupon data population.
// Replace '.your-coupon-button-class' with the actual CSS class you gave your button in Elementor.
const couponButtons = document.querySelectorAll('.your-coupon-button-class');
couponButtons.forEach(button => {
button.addEventListener('click', function(event) {
event.preventDefault(); // Prevents the button's default action (e.g., submitting the form prematurely)
const card = this.closest('.coupon-card');
if (card) {
const data = card.querySelector('.coupon-data');
const form = card.querySelector('form');
if (data && form) {
// Pulling only the product title for testing
const productTitle = data.dataset.productTitle;
// Assuming your Gravity Forms hidden field for the product title has the name "input_1"
// You must verify this in your Gravity Forms field settings.
const hiddenField = form.querySelector('input[name="input_1"]');
if (hiddenField) {
hiddenField.value = productTitle;
console.log('Product title set to:', hiddenField.value); // For debugging: check the browser console
}
}
}
});
});
});
Please fill out this form to sign up for the 256Local NewsletterÂ
256Local Marketing
256Local Marketing