YourEverydayCodingEnthusiast YourEverydayCodingEnthusiast - 2 years ago 113
HTML Question

How to save input value using javascript for later use in html

I wanted to create a website that saves an input tag's data for later use. My goal is to create a posting system where you could close the file and have the same posted input data still showing in a div element. Is this possible to do with html and javascript or do I have to use php or something else like that? Could it be done if the data was stored in a log file and then sorted through with javascript? If this only works in php is there a roundabout way of using a html or javascript? I plan to host this on GitHub so if this is impossible please tell me. Thanks!

Answer Source

You can use web storage for client side only as follows:

localStorage.setItem("lastname", "Smith");
document.getElementById("result").innerHTML = localStorage.getItem("lastname");

see this tutorial for web storage


If you need a shared storage to access it from all clients, you have to use server side session

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download