Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. // run this in the terminal to save the state of all inputs
  2. // in your browser's LocalStorage:
  3. [].forEach.call(document.querySelectorAll("input"), function(el) {
  4. localStorage.setItem(el.name, el.value);
  5. });
  6.  
  7. // then refresh the page and run this to restore your form values:
  8. [].forEach.call(document.querySelectorAll("input"), function(el) {
  9. el.value = localStorage.getItem(el.name);
  10. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement