Source Code:
(back to article)
Submit
Result:
Report an issue
<body> <div>Start writing an email address in the following input. Refresh the page in the middle of your typing, and you'll see that the page remembers what you entered before.</div> <br /> <input type="email" id="email"/> </body> <script> window.onload = function() { const email = sessionStorage.getItem('email'); if (email) { alert('email found from session storage: ' + email); document.getElementById('email').value = email; } document.getElementById('email').onkeyup = function() { sessionStorage.setItem('email', this.value); }; }; </script>