views:

81

answers:

1

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

A: 

I believe your question in unclear because of this part:

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.

Please clarify it more... Why would you double-hit enter? What object is focused when you double-hit enter?

Even though i know im probably wrong. It sounds like you have one table that turns in to two tables. Do you mean <table>'s? Or DB tables?

Just being more clear would help ;)

WmasterJ