TargetBay’s Resource Hub

Your complete guide to marketing resources, designed to boost your ROI

7 Examples of Automated Text Messages

Although automation is the buzzword in every industry, we’d say it’s a savior, especially in…

7 Ways to Incorporate SMS Marketing into Your Holiday Promotions This Year

Is driving traffic and making conversions your primary goal this holiday season? Yes! I know…

10 Most Effective SMS Marketing Strategies For E-commerce

The activity of using mobile devices has now reached almost the highest indicators. This is…

How to Build Brand Trust with Consumers: A Guide for eCommerce Brands

Building trust with consumers is essential for any eCommerce brand’s long-term success. It’s the invisible…

How to Ask Customers for Reviews: Best Practices [2025]

Learning to ask customers for reviews can do wonders for your brand. Reviews build an…

Big things are brewing—stay in the loop!

Want more insights, tips, and updates straight to your inbox? Drop your email below,
and we’ll make sure you never miss a thing!
const BF_TARGET = new Date('2025-11-28T23:59:59-05:00'); // New York (EST) target const BLOCKED_DOMAINS = [ "gmail.com","yahoo.com","hotmail.com","outlook.com","aol.com","icloud.com", "protonmail.com","zoho.com","ymail.com","live.com" ]; // IDs const FORM_WIDGET_ID = 'tb-form'; // your Form widget CSS ID (you set this) const FORM_PLACEHOLDER_ID = 'tb-form-container'; const H_ID = 'tb-hours', M_ID = 'tb-minutes', S_ID = 'tb-seconds'; // --------- Move the form widget into the placeholder ------------ document.addEventListener('DOMContentLoaded', function () { try { // find the widget container and the placeholder const widgetContainer = document.getElementById(FORM_WIDGET_ID); const placeholder = document.getElementById(FORM_PLACEHOLDER_ID); // if both exist, move the whole widget (keeps Elementor markup & styles) if (widgetContainer && placeholder && !placeholder.contains(widgetContainer)) { placeholder.appendChild(widgetContainer); } // find the actual
element inside the widget (Elementor structures vary) const formEl = (widgetContainer && (widgetContainer.querySelector('form') || widgetContainer.querySelector('.elementor-form'))) || null; if (!formEl) return; // ---------- Countdown ---------- function updateCountdown() { const now = new Date(); const diff = BF_TARGET - now; if (diff <= 0) { const h = document.getElementById(H_ID), m = document.getElementById(M_ID), s = document.getElementById(S_ID); if (h) h.textContent = '00'; if (m) m.textContent = '00'; if (s) s.textContent = '00'; return; } const hours = Math.floor(diff / 36e5); const minutes = Math.floor((diff % 36e5) / 6e4); const seconds = Math.floor((diff % 6e4) / 1000); const hEl = document.getElementById(H_ID), mEl = document.getElementById(M_ID), sEl = document.getElementById(S_ID); if (hEl) hEl.textContent = String(hours).padStart(2,'0'); if (mEl) mEl.textContent = String(minutes).padStart(2,'0'); if (sEl) sEl.textContent = String(seconds).padStart(2,'0'); } setInterval(updateCountdown, 1000); updateCountdown(); // ---------- Validation: only work email ---------- // find first email input inside form const emailInput = formEl.querySelector('input[type="email"]'); // create inline error node if not present let errNode = null; if (emailInput) { const parent = emailInput.parentNode; errNode = parent.querySelector('.tb-error-inline'); if (!errNode) { errNode = document.createElement('div'); errNode.className = 'tb-error-inline'; errNode.style.display = 'none'; parent.appendChild(errNode); } } // intercept submit formEl.addEventListener('submit', function (ev) { if (!emailInput) return; const val = (emailInput.value || '').trim().toLowerCase(); // basic format const basic = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val); const domain = val.split('@')[1] || ''; const isPersonal = BLOCKED_DOMAINS.includes(domain); if (!basic) { ev.preventDefault(); if (errNode) { errNode.textContent = 'Please enter a valid work email.'; errNode.style.display = 'block'; } emailInput.focus(); return; } if (isPersonal) { ev.preventDefault(); if (errNode) { errNode.textContent = 'Please use a work email — personal emails (Gmail/Yahoo/Outlook/etc.) are not accepted.'; errNode.style.display = 'block'; } emailInput.focus(); return; } // passed validation: hide error and allow submit if (errNode) errNode.style.display = 'none'; // optionally show submitting state const submitBtn = formEl.querySelector('[type="submit"], .elementor-button'); if (submitBtn) { submitBtn.dataset.origText = submitBtn.textContent; submitBtn.disabled = true; submitBtn.textContent = 'Submitting…'; } // restore button after short delay (Elementor will do the actual actions) setTimeout(() => { if (submitBtn) { submitBtn.disabled = false; submitBtn.textContent = submitBtn.dataset.origText || submitBtn.textContent; } }, 3000); }); // hide any leftover inline errors when user types if (emailInput && errNode) { emailInput.addEventListener('input', () => { errNode.style.display = 'none'; }); } } catch (e) { console.warn('BFCM popup script error', e); } }); // ---------- Close popup (used by your close button) ---------- function closePopup() { const overlay = document.getElementById('tb-overlay'); if (!overlay) return; overlay.style.transition = 'opacity .25s ease'; overlay.style.opacity = '0'; setTimeout(() => { if (overlay && overlay.parentNode) overlay.parentNode.removeChild(overlay); }, 260); }