dhtml - Dynamic HTML using Javascript -
I am using javascript to create a grid of input elements in dynamically in HTML. Each row has 4 input elements and users can add or remove rows as they are necessary. Every time they add or remove a line, I am dynamically rebuilding the grid.
My problem is after making a grid for the second time, I can not reference any element. I believe that there are two incidents of each element in the DOM with the same name now, and when I try to refer to the name, it is confusing.
My question: There is no way to reset the DOM list of element names, so the name "reside" on every dynamic build is still unique?
Every time you create a grid and every time you join it, You can give unique prefix references to a node by ID.
Or you can change your code every time to not completely refill the entire grid.
However, I think it may happen that you have mis-discovered the problem or I do not understand your question correctly. If you remember to remove the old table element from the document before inserting a new one, there should be no conflict on the IDs or names.
Comments
Post a Comment