I have a dynamic table where I add rows dynamically when the user clicks a button.
My button call the following function :
<input type="button" value="Add" onclick="addRowTuy($('#AmonttableTuy tbody'), 'AmontTuy');" />
My function adds a new rows to my table. It include text fields, inputs and select.
I have no problem for the creation of new inputs and text, but for the select, I want copy an existing select and change its id. That's my problem.
This is the function where I create a new rows in my table:
function addRowTuy(table, value)
{
var nbrow = table.children().size();
table.append( "<tr>"+
"<td>"+(nbrow+1)+"</td>"+
"<td><input id='"+value+(nbrow+1)+"Diam"+"'/></td>"+
"<td><input id='"+value+(nbrow+1)+"Long"+"'/></td>"+
"<td>"+$("#AmontTuy1Type")+"</td>"+ //This is where I want copy the select element
"<td><input id='"+value+(nbrow+1)+"Rugo"+"'/></td>"+
"</tr>");
}
Have you an idea on the way to do this?