Is it possible to save data from form to localStorage AND submit the form? I need to submit the form but it would be important to save the values to localStorage also. How can I do this?
Here is the code I have for the form and localStorage, but this doesn’t submit the form. It just saves the values.
<label for="server"> Server: </label>
<input type='text' name="server" id="saveServer"/>
<button onclick="save_data()" type="button" value="Save" id="Save" data-theme="a">Save</button>
<script> function save_data()
{ var input = document.getElementById("saveServer");
localStorage.setItem("server", input.value);
var storedValue = localStorage.getItem("server"); }
Sure, but you’ll probably want to shake up your approach a bit to call
save_dataas the form is being submitted: