Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ const riskForm = document.getElementById('riskForm');
+ const meterFill = document.getElementById('meterFill');
+ const riskScore = document.getElementById('riskScore');
+ const recommendations = document.getElementById('recommendations');
+
+ riskForm.addEventListener('submit', (e) => {
+ e.preventDefault();
+
+ const financial = parseInt(document.getElementById('financialSelect').value) || 0;
+ const market = parseInt(document.getElementById('marketSelect').value) || 0;
+ const experience = parseInt(document.getElementById('experienceSelect').value) || 0;
+
+ if (!financial || !market || !experience) {
+ alert('Please complete all fields');
+ return;
+ }
+
+ const totalScore = calculateRiskScore(financial, market, experience);
+ const percentage = (totalScore / 12) * 100;
+
+ meterFill.style.width = `${percentage}%`;
+ riskScore.textContent = `${totalScore}/12`;
+
+ displayRecommendations(totalScore);
+ });
+
+ function calculateRiskScore(financial, market, experience) {
+ return financial + market + experience;
+ }
+
+ function displayRecommendations(score) {
+ let message = '
Recommendations:
+
+ if (score < 6) {
+ message += `
+
Consider building more savings before starting+
Conduct more market research+
Gain more experience in your field+
Consider starting part-time while maintaining current employment+ `;
+ } else if (score < 9) {
+ message += `
+
You're on the right track, but there's room for improvement+
Focus on strengthening your weakest areas+
Create a detailed business plan+
Consider seeking mentorship+ `;
+ } else {
+ message += `
+
You're well-prepared for self-employment+
Continue monitoring market changes+
Maintain emergency funds+
Consider creating multiple income streams+ `;
+ }
+
+ message += '';
+ recommendations.innerHTML = message;
+ }
+ });