Skip to content
Grist home
Support nonprofit news today

Uncategorized

Featured

window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-8L4CPT2Q80'); document.addEventListener('DOMContentLoaded', function () { const questions = document.querySelectorAll('.question'); const responses = { "The Wealthiest": 0, "The Most Vulnerable": 0, "The Many": 0, "The Newcomers": 0 }; const selectedAnswers = {}; let answeredQuestionsCount = 0; questions.forEach((question, index) => { const answerInputs = question.querySelectorAll('input[type="radio"]'); // Iterate over each answer in a question answerInputs.forEach(input => { input.addEventListener('click', function () { const selectedValues = input.value.split(','); const previousValues = selectedAnswers[index]; if (previousValues) { previousValues.forEach(category => { responses[category.trim()]--; }); } if (!previousValues) { answeredQuestionsCount++; } console.log(responses); // Add the score based on the selected answer ... Read more

All Stories