Whenever I input data into the form and click on the calculate button, the result does not appear in the salary slip box at the bottom of the form.
However, if I refresh the page and then click on the calculate button, the results are displayed correctly in the box.
For more details, you can view the code by following this link: JsfiddleLink
"use strict";
const employeeName = document.querySelector("#input-name").value;
const grossPay = document.querySelector("#input-pay").value;
const bonus = document.querySelector("#input-bonus").value;
const allowance = document.querySelector("#input-allowance").value;
const incomeTax = document.querySelector("#input-tax").value;
const ei = document.querySelector("#input-ei").value;
const cpp = document.querySelector("#input-cpp").value;
const selectGender = document.querySelector(
'input[name="gender"]:checked'
).value;
const selectDependent = document.querySelector(
'input[name="dependent"]:checked'
).value;
const btnCalculate = document.querySelector("#submit");
const btnClear = document.querySelector(&q...