I want to clone every element at .dynamic-content1 and automatically increment itself and every id of it's children to make it unique and also can remove the last cloned .dynamic-content, the following code are:
<div class="dynamic-content1">
<div class="dynamic-wrapper">
<p><strong>Child | 1</strong></p>
<div class="dynamic-row">
<label>Fullname</label>
<div class="right">
<input type="text" name="chname1" id="chname1" />
</div>
</div>
<div class="dynamic-row">
<label>Place of Birth</label>
<div class="right">
<input type="text" name="chpob1" id="chpob1" />
</div>
</div>
<div class="dynamic-row">
<label>Date of Birth</label>
<div class="right">
<input type="text" class="datepicker" id="chdate1" name="chdate1" />
</div>
</div>
<div class="dynamic-row">
<label>Highest Education</label>
<div class="right">
<input type="text" name="chedu1" id="chedu1" />
</div>
</div>
<div class="dynamic-row">
<label>Occupation</label>
<div class="right">
<input type="text" name="chocc1" id="chocc1" />
</div>
</div>
</div>
</div>
the .dynamic-wrapper and .dynamic-row just for styling purpose.
Actually I already can do this, but in a very very dirty way and not very effective, is there anyway you guys can show me using .clone()? Already cracking skull here. :)
My way to achieve this: http://jsfiddle.net/R2c5K/