
Insurance Tips
const postsData = [ { category: 'healthcare', imgSrc: 'https://www.blank-insurance.com/images/healthcare.jpg', title: 'Are There Plans That Cover Specific Health Needs Like Prescription Drugs or Mental Health Services?', excerpt: 'Understanding the different health insurance plans that cover specific needs like prescription drugs or mental health services can help you make an informed decision...', link: 'https://www.blank-insurance.com/tips-tricks/are-there-plans-that-cover-specific-health-needs-like-prescription-drugs-or-mental-health-services' }, { category: 'life-insurance', imgSrc: 'https://www.blank-insurance.com/images/life-insurance.jpg', title: 'What Happens If My Life Insurance Application Is Declined?', excerpt: 'Getting declined for life insurance can be frustrating, but there are steps you can take to understand the reasons and find a solution that works for you...', link: 'https://www.blank-insurance.com/tips-tricks/what-happens-if-my-life-insurance-application-is-declined' }, { category: 'medicaid', imgSrc: 'https://www.blank-insurance.com/images/medicaid.jpg', title: 'Understanding Medicaid in Illinois: A Simple Guide', excerpt: 'Medicaid in Illinois is a health insurance program that provides free or low-cost medical coverage to eligible residents. Medicaid helps people in Illinois get the medical care they need...', link: 'https://www.blank-insurance.com/tips-tricks/understanding-medicaid-in-illinois-a-simple-guide' }, { category: 'medicare', imgSrc: 'https://www.blank-insurance.com/images/medicare.jpg', title: 'What Are the Penalties for Not Having Health Insurance?', excerpt: 'Learn about the penalties for not having health insurance, how they are calculated, and what you can do to avoid them. Ensure you have the coverage you need...', link: 'https://www.blank-insurance.com/tips-tricks/what-are-the-penalties-for-not-having-health-insurance' }, { category: 'retirement-planning', imgSrc: 'https://www.blank-insurance.com/images/retirement.jpg', title: 'Understanding Safe and Risky Investments', excerpt: 'Investing always involves some level of risk. It’s important to know the risk level of different types of investments and think about how they fit with your age, financial goals, and available resources...', link: 'https://www.blank-insurance.com/tips-tricks/understanding-investments' }, // Add more blog post data here ]; function createTabs(categories) { const tabsContainer = document.getElementById('tabs'); categories.forEach(category => { const button = document.createElement('button'); button.classList.add('tab'); button.textContent = category.charAt(0).toUpperCase() + category.slice(1).replace('-', ' '); button.setAttribute('onclick', `filterPosts('${category}')`); tabsContainer.appendChild(button); }); } function createPosts(posts) { const postsContainer = document.getElementById('posts-container'); postsContainer.innerHTML = ''; posts.forEach(post => { const postElement = document.createElement('div'); postElement.classList.add('post'); postElement.setAttribute('data-category', post.category); postElement.innerHTML = ` <img src="${post.imgSrc}" alt="${post.title}"> <div class="post-content"> <h2>${post.title}</h2> <p>${post.excerpt}</p> <a href="${post.link}">Read more</a> </div> `; postsContainer.appendChild(postElement); }); } function filterPosts(category) { const posts = document.querySelectorAll('.post'); posts.forEach(post => { if (category === 'all') { post.style.display = 'block'; } else { if (post.getAttribute('data-category') === category) { post.style.display = 'block'; } else { post.style.display = 'none'; } } }); } document.addEventListener('DOMContentLoaded', () => { const categories = [...new Set(postsData.map(post => post.category))]; createTabs(categories); createPosts(postsData); filterPosts('all'); });
Top Stories