How to organize the storing form data in LocalStorage if do not rummage in js?

<form method="post" class="rename" style="margin: 0px; padding: 0px;">
 <input title="click To change" type="text" value="blank" style=" cursor: text auto; border:none;">
 </form>
I have a form

It is necessary to implement storage user-changed values in localStorage
Found the script code
the <script>
 if (window.localStorage) {
 var elements = document.querySelectorAll('[name]');

 for (var i = 0, length = elements.length; i < length; i++) {
 (function(element) {
 var name = element.getAttribute('name');

 element.value = localStorage.getItem(name) || ";

 element.onkeyup = function() {
 localStorage.setItem(name, element.value);
};
})(elements[i]);
}
}
 </script>

but it doesn't work for some reason (just in the programming zero)
July 2nd 19 at 13:11
1 answer
July 2nd 19 at 13:13
Solution
In your case, the input's and no attribute name, add a name, for example:
<input title="click To change" name="status" type="text" value="blank" style=" cursor: text auto; border:none;">


You can still save the form completely -- api.jquery.com/serialize

Find more questions by tags JavaScriptHTMLLayout