javascript - Can I save innerHTML of an element to HTML5 Local storage -
i want elements within ordered list using
var listdata = document.getelementbyid('mylist').innerhtml;
then store what's contained in variable listdata local storage. if possible, how go saving contents of variable localstorage? if not possible, i'll accept alternative. also, i'd know how retrieve data once it's saved. thanks
yes, can:
if (localstorage) { // browser supports localstorage.somekeyname = document.getelementbyid("mylist").innerhtml; }
details in the spec. there large number of tutorials out there.
if need duration of current visit , not between visits, use sessionstorage
instead of localstorage
above.
note there limits on size of can store in web storage, , limits may vary browser.
Comments
Post a Comment