BIOLOGY SCIENCE – 12-55 Aug 13

lets say i have a HTML element to be stored as a cache. is it better to store the element in the DOM and using the display: none to hide it so the user cant see it and when needed change the display to block to make the element visible or get the content of the element like this
<div>
<span>lol</span>
content
</div>
<div>
<span>lol</span>
content
</div>
and save it to a txt file and deleting the element so it longer stays in the DOM and when needed read that saved txt file and insert the element to the DOM which method is better ? (in terms of performance and bugs / problems)
4 Replies
ScriptyChris
ScriptyChris3y ago
@BIOLOGY SCIENCE what do you want to store in that DOM? And why would you save it to file? What's your end goal?
RelativPerspektiv
when a user clicks a button, a set of data is represent as html elements, the next time the button is clicked a new set of data is represented (this new data replaces the old set of data in the context of html elements) if the user wishes to look back the previous data is it better to store those html elements in a txt file and insert it to the DOM when the user requests for the previous data or keep the html elements in the DOM itself, but just hide the elements when not in use, and make then appear when the user asks for the previous data @ScriptyChris
ScriptyChris
ScriptyChris3y ago
Why don't you just keep that data in JS memory (object/array) and render element on user demand?
reactibot
reactibot3y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1007995751604945006