I want to copy the entire contents of a div to another div, but before copying, I need to change all the input field names and identifiers. See code below.
<div id="first_div">
<input type="text" name="firstname" id="firstname">
<select name="marital_status" id="marital_status">
<option value="1" selected='selected'>Select</option>
<option value="2">Single</option>
<option value="3">Married</option>
</select>
</div>
<div id="second_div">
</div>
Now I want to copy the contents of first_div to second_div, but before copying I need to change the name of the firstname field to last_name, how can I do this?
jones source
share