0

Hi everyone. I am a novice at javascript and can't figure out the following:

I have a table where the user can press an "add more" button which duplicates the row and displays it on the next line. I use this for my site to have the user input stock prices which may be split in multiple orders after they execute them. Here is my JS code:

<script>
function insert(button) {var cell, newRow, row, sect;
if((cell = button.parentNode) && (row = cell.parentNode)
&& row.cloneNode && (sect = row.parentNode)
&& sect.insertBefore)
{
newRow = row.cloneNode(true);
/* If you need to alter the new row
* or its contents, do it here.
*/
sect.insertBefore(newRow, row.nextSibling);
}
}
</script>

This works fine. However, since I am submitting this with a form I need each cell id to have its own unique identifier. The way the code is now, the cloned cell has the same id as the original and only the data for one gets submitted. Any ideas would be much appreciated...

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Troy III
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.