How do I include 2 tables in one LocalStorage item?

Posted by Noor on Stack Overflow See other posts from Stack Overflow or by Noor
Published on 2010-04-30T15:04:58Z Indexed on 2010/04/30 15:17 UTC
Read the original article Hit count: 294

Filed under:
|
|
|

I've got a table that you can edit, and I've got a simple code saving that list when you're done with editing it.

(the tables have the contenteditable on)

The problem I've stumbled upon is that if I double click on enter, the table gets divided into two separate tables with the same ID. This causes the code I'm using to set the localStorage to only store one of the tables (I assume the first).. I've thought of different solutions and I wonder if someone could point out the pro's and con's (if the solutions even works that is).

  1. Make a loop that checks the page after tables and stores them into an array of localStorage-items.. I'd have to dynamically create a localStorage item for each table.

  2. Take the whole div that the tables are in, and store that in the localStorage, when a user revisits the page, the page checks after the items in storage and displays the whole divs.

  3. Any suggestions you have that can beat this :).. (but no cache, it has to be with the localStorage!)

Thanks

© Stack Overflow or respective owner

Related posts about localstorage

Related posts about html5