Changed around line 1
+ document.getElementById('propertyForm').addEventListener('submit', function(e) {
+ e.preventDefault();
+
+ const propertyValue = parseFloat(document.getElementById('propertyValue').value);
+ const rentalIncome = parseFloat(document.getElementById('rentalIncome').value);
+ const expenses = parseFloat(document.getElementById('expenses').value);
+ const years = parseFloat(document.getElementById('years').value);
+
+ const rentalProfit = (rentalIncome - expenses) * 12 * years;
+ const saleProfit = propertyValue * 1.05; // Assuming 5% appreciation
+
+ document.getElementById('rentalProfit').textContent = `Total Rental Profit over ${years} years: $${rentalProfit.toLocaleString()}`;
+ document.getElementById('saleProfit').textContent = `Estimated Sale Profit: $${saleProfit.toLocaleString()}`;
+
+ if (rentalProfit > saleProfit) {
+ document.getElementById('recommendation').textContent = 'Recommendation: Continue Renting';
+ } else {
+ document.getElementById('recommendation').textContent = 'Recommendation: Sell the Property';
+ }
+ });