I need to get data from an HTML form and store them at localStore, but I'm running into some problems while attempting to tho this.
Let's make a short example:
<form class="w3-container" id="form">
<p><label>Name</label><input class="w3input" type="text" id="name"></p>
<p><label>Adress</label><input class="w3-input" type="text" id="adress"></p>
<p><label>Number</label><input class="w3-input" type="text" id="number"></p>
<button class="w3-button w3-blue">Submit</button>
</form>
Then JavaScript code:
localStorage.setItem("name", document.getElementById("name").value);
localStorage.setItem("adress", document.getElementById("adress").value);
localStorage.setItem("number", document.getElementById("number").value);
I have tried a different number of ways to do this but nothing seems to work. What am I missing?