user1056534
user1056534

Reputation: 5

Cloning last row of table

I am cloning the last row of my table and I am using

$('#table tr:last').clone(true).appendTo('#table')

Clone last row and change the onchange part?

<SELECT NAME=country[] id="country" onchange="change(this,'city')">
<option value=' ' selected='selected'>Please Choose one</option>
<option value'1'>UK</option>
<option value'2'>USA</option>
<option value'3'>France</option>
</select>

<SELECT NAME=city[] id="city" onchange="change(this,'country')">
<option value=' ' selected='selected'>Please Choose one</option>
<option value'1'>London</option>
<option value'2'>New York</option>
<option value'3'>Paris</option>
</select>

Upvotes: 0

Views: 1235

Answers (1)

kumiau
kumiau

Reputation: 724

A good way to approach this is to store the table row element in a variable, manipulate its children and then, append it.

Here's the code i wrote. See if it helps. http://jsfiddle.net/drYKX/

Upvotes: 1

Related Questions