Best Travel Insurance Provider Finder

Best Travel Insurance Provider Finder

Answer a few questions to find the best insurance provider for your trip.

1
2
3

Trip Details

$

No suitable providers found based on your criteria. Please try adjusting your selections.

`; return; } results.forEach((provider, index) => { const bestTag = index === 0 ? `
Top Match
` : ''; const card = `
${bestTag}

${provider.name}

Best for: ${provider.bestFor}

Estimated Price

$${provider.finalPrice.toFixed(2)}

Key Coverage Limits (per person):

Cancellation$${provider.cancellation.toLocaleString()}
Medical$${provider.medical.toLocaleString()}
Evacuation$${provider.evacuation.toLocaleString()}
Baggage$${provider.baggage.toLocaleString()}
`; resultsOutput.innerHTML += card; }); } function startOver() { currentStep = 1; updateUI(); mainForm.classList.remove('hidden'); resultsSection.classList.add('hidden'); // Optional: reset form fields document.getElementById('insurance-finder-container').querySelector('form')?.reset(); initialize(); } // --- PDF DOWNLOAD LOGIC --- function downloadSummaryAsPDF() { const { jsPDF } = window.jspdf; if (!jsPDF) { alert("PDF library not loaded."); return; } const doc = new jsPDF(); // --- Collect data for PDF --- const tripCost = parseFloat(inputs.tripCost.value) || 0; const startDate = new Date(inputs.startDate.value); const endDate = new Date(inputs.endDate.value); const tripDuration = Math.ceil((endDate - startDate) / (1000 * 60 * 60 * 24)) + 1; const userChoices = [ ['Destination', inputs.destination.options[inputs.destination.selectedIndex].text], ['Trip Dates', `${inputs.startDate.value} to ${inputs.endDate.value} (${tripDuration} days)`], ['Total Trip Cost (per person)', `$${tripCost.toLocaleString()}`], ['Traveler Age', inputs.travelerAge.value], ['Number of Travelers', inputs.numTravelers.value], ]; const results = Array.from(resultsOutput.children).map(card => { const name = card.querySelector('h3').textContent; const price = card.querySelector('.text-3xl').textContent; const limits = Array.from(card.querySelectorAll('.grid div')).map(el => el.textContent); return [name, price, ...limits]; }); // --- PDF Content & Formatting --- doc.setFontSize(20); doc.setFont("helvetica", "bold"); doc.text("Travel Insurance Summary", 105, 20, null, null, "center"); doc.autoTable({ startY: 30, head: [['Your Trip Details', '']], body: userChoices, theme: 'striped', headStyles: { fillColor: [37, 99, 235] } // blue-600 }); doc.autoTable({ startY: doc.autoTable.previous.finalY + 15, head: [['Provider', 'Price', 'Cancellation', 'Medical', 'Evacuation', 'Baggage']], body: results, theme: 'grid', headStyles: { fillColor: [22, 163, 74] } // green-600 }); doc.save('Travel-Insurance-Summary.pdf'); } // --- START THE APP --- initialize(); });
Scroll to Top