I'm trying to pass the input value from index.html to be displayed on another input element in financial.html when clicking the ref link (calculate) so that the user doesn't need to input the same value twice on the financial.html page.
function handleSubmit() {
const income = document.getElementById('income').value;
localStorage.setItem("INCOME", income);
return;
}
window.addEventListener('load', () => {
const income = localStorage.getItem("INCOME");
document.getElementById('netIncome').innerHTML = income;
})
<!--input element on index.html-->
<input type="number" name="income">
<a href="financial.html" onlick="handleSubmit()">Calculate</a>
<!--input element on financial.html-->
<input id="netIncome" type="number">
I managed to pass the value but it's not showing up in the second input box and I have to input the value again.
Any help is much appreciated. Thank you.