0

Local storage

Is it possible to save a css class to local storage? I'm creating a shopping list app and I want to save the text and also the style of the list item

23rd Jul 2022, 8:18 PM
Ishak
Ishak - avatar
4 Réponses
+ 1
This site learn you how to use local storage (in case you need it, i forgot to mention), you can save class name like any other data you save. Like: localStorage.setItem('myClass', 'specialClass'); const cssClass = localStorage.getItem('myClass'); // so when we have cssClass we can use it to append to element we need
24th Jul 2022, 7:51 AM
PanicS
PanicS - avatar
0
Are we tolk about local storage, storage to save website data so when website tab is closed and opened again user can have this data back? Well you probably can just save name of class, and when you need it take this data, like any other data. https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
23rd Jul 2022, 10:20 PM
PanicS
PanicS - avatar
0
PanicS sending me a link to a random website isn't answering my question...that website says nothing about using css in local storage 🙂
23rd Jul 2022, 11:03 PM
Ishak
Ishak - avatar
0
Shavanta Wright I want to save css for an android app after the user leaves, not for sololearn
23rd Jul 2022, 11:06 PM
Ishak
Ishak - avatar