document.addEventListener('DOMContentLoaded', function () { let currentStep = 0; const steps = document.querySelectorAll('.form-step'); const stepIndicators = document.querySelectorAll('.step'); function showStep(step) { steps.forEach((stepElement, index) => { if (index === step) { stepElement.classList.add('form-step-active'); stepIndicators[index].classList.add('active'); } else { stepElement.classList.remove('form-step-active'); stepIndicators[index].classList.remove('active'); } }); } function nextStep() { if (currentStep < steps.length - 1) { currentStep++; showStep(currentStep); } } function prevStep() { if (currentStep > 0) { currentStep--; showStep(currentStep); } } document.querySelectorAll('.next-step').forEach(button => { button.addEventListener('click', nextStep); }); document.querySelectorAll('.prev-step').forEach(button => { button.addEventListener('click', prevStep); }); document.querySelector('#simulation-form').addEventListener('submit', function (event) { event.preventDefault(); let renda Bruta = document.querySelector('[name="renda-bruta"]').value; let valorFinanciamento = rendaBruta * 10; // Exemplo simplificado document.getElementById('resultado').innerText = `Valor do Financiamento: R$ ${valorFinanciamento.toFixed(2)}`; }); showStep(currentStep); });