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)
S
ScriptyChris614d 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?
R
RelativPerspektiv614d ago
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
S
ScriptyChris614d ago
Why don't you just keep that data in JS memory (object/array) and render element on user demand?
UU
Unknown User613d ago