views:

27

answers:

1

My plan was to use jQuery's .data() method to store my table row information in a hidden div element.

Then, upon clicking an Add or Remove row button, I would modify the jQuery data in the hidden div, clear the table div contents, and then regenerate the table's rows from the data stored in the hidden div.

To start with, my project handles at most five or six rows, four columns. Not much data, but I'm not too experienced with jQuery, so my question is whether this is the ideal way to go about this, or if there are gotchas in doing this before I start writing code. Thanks for your advice.

A: 

Why not just store the data in memory in JavaScript and then do a replaceWith() the new HTML?

infamouse
If I keep it in memory, will the data be accessible to jQuery routines called in other .js files?
Alex Reynolds
Yes, it will. As long as it's in the global scope.
infamouse