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
4 Answers
+ 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
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
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 š
0
Shavanta Wright I want to save css for an android app after the user leaves, not for sololearn