Skip to content
Home
About
Free Booklets
Blog
Bookstore
Home
About
Free Booklets
Blog
Bookstore
Donate
Facebook
Youtube
Home
About
Free Booklets
Blog
Bookstore
Home
About
Free Booklets
Blog
Bookstore
Cart
Your cart is currently empty.
Return to shop
document.addEventListener('DOMContentLoaded', function () { console.log('📚 Ebook Button Handler Loaded'); document.querySelectorAll('.open-book-popup').forEach(function (btn, i) { btn.addEventListener('click', function (e) { e.preventDefault(); console.log(`🟩 Clicked Ebook Button #${i + 1}`, btn); const container = btn.closest('.elementor-container, .elementor-widget'); if (!container) return console.warn('❌ No container found for this button.'); const bookEl = container.querySelector('[data-book]'); const popupEl = container.querySelector('[data-popup-id]'); const bookTitle = bookEl?.getAttribute('data-book') || ''; const popupId = popupEl?.getAttribute('data-popup-id') || ''; const input = document.querySelector('input[name="book_title"]'); console.log('📖 Book Title:', bookTitle); console.log('🆔 Popup ID:', popupId); console.log('📩 Hidden Input:', input); if (input && bookTitle) { input.value = bookTitle; console.log('✅ Set hidden field to:', bookTitle); } else { console.warn('⚠️ Missing input or book title'); } if (typeof JetPopup !== 'undefined' && popupId) { console.log('🚀 Triggering JetPopup ID:', popupId); JetPopup.showPopup(parseInt(popupId)); } else { console.warn('❌ JetPopup not available or popup ID missing'); } }); }); });