0

I am trying to capture user input then put it in local storage. I want listen to every element on the page if there is input then grab it. But when i tried to test it, it is returning "undefined" as value. Why?

(function () {
  $(document).on("input", function () {
    data = document.getElementsByName("*").value;
    localStorage.setItem("test", data);
  });
})();

0 Answers0