Html table data caching? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Html table data caching?

What is the best way to implement "caching" using vanilla js on tables? How "caching" works? Thanks for your answer

22nd Oct 2021, 7:22 PM
Emanuel Maliaño
Emanuel Maliaño - avatar
1 Answer
+ 1
Hello, The most common vanilla js libary functions like getElementById return an ovject, e.g. try to run this: typeof document.getElementById("#yourTableId"). The output should be "object". But you can use localStorage and sessionStorage only with strings, so I'd advise you to read all values of you table with a loop, then store it in sessionStorage.
22nd Oct 2021, 10:23 PM
Sebastian Ahlborn
Sebastian Ahlborn - avatar