Improving great answer by @dmackerman a bit (I cannot comment yet) by preventing to delete if there is only one row
HTML:
<form>
<p class="form_field">
<label>Name:</label> <input type="text">
<label>Age:</label> <input type="text">
<span class="remove">Remove</span>
</p>
<p>
<span class="add">Add fields</span>
</p>
</form>
and JS:
$(".add").click(function() {
$("form > p:first-child").clone(true).insertBefore("form > p:last-child");
return false;
});
$(".remove").click(function() {
if ($(".form_field").length > 1) {
$(this).parent().remove();
}
});