If you're new to Index DB, you might be facing a simple fix issue that's not in your code. Utilizing live server for display, the error you encounter is regarding the total Money not displaying as expected in the HTML, generating a console error: Here. Your attention to this matter is appreciated.
Below is the content of my dbFunctions.js file:
let db;
let request = indexedDB.open("financeManager", 1);
...
Below are the addIncome.js and addIncome.html files respectively:
const dropdownIncome = document.getElementById("dropdownIncome");
const optionForms = document.querySelectorAll(".options");
//submit btns form
const submitOneTime = document.getElementById("submitOneTime");
const submitMonthly = document.getElementById("submitMonthly");
const submitInterest = document.getElementById("submitInterest");
...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<select id="dropdownIncome">
<option value="default">--</option>
<option value="optionOneTime">
One-Time Income
</option>
<option value="optionMonthly">
Monthly Income
</option>
<option value="optionInterest">
Interest Income
</option>
</select>
...
</body>
</html>
Next up are the addExpenses.js and addExpenses.html files:
const dropdownExpenses = document.getElementById("dropdownExpenses");
const optionForms = document.querySelectorAll(".options");
//submit btns form
const submitMonthly = document.getElementById("submitMonthly");
const submitOneTime = document.getElementById("submitOneTime");
const submitMortgage = document.getElementById("submitMortgage");
...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href = "addExpenses.css">
<title>Document</title>
</head>
<body>
...
</body>
</html>
Finally, the financetracker.js, .css, and .html files:
//input daily expenses, includes consistent expenses as well as one-time purchases...
document.addEventListener("DOMContentLoaded", function(){
var totalMoney = 10000000;
checkAndInitializeTotalMoney(totalMoney);
...
.viewButtons{
width: 350px;
height: 200px;
font-size: 50px;
font-family: 'Times New Roman', Times, serif;
border-radius: 10px;
}...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="financetracker.css">
</head>
<body>
<div class="balanceBottomLine">
...
</body>
</html>