 <p>you need to set these attributes of elements as as:</p> <pre><code>$(document).ready(function () { $('#group').on('click', '.add_subgroup', function () { var i = $('div.subgroup').length; var where = $('#group'); var subgroup = $('#subgroup_hidden').clone(); var j = i + 1; subgroup.attr({ 'id': 'subgroup_' + j, 'class': 'subgroup' }).appendTo(where); subgroup.find('input, select, textarea').each(function(){ $(this).attr({ name: '', value: '' }) if($(this).is('textarea')) $(this).text(''); }) i++; }); $('#group').on('click', '.remove_subgroup', function () { $(this).closest('.subgroup').remove(); }); }); </code></pre> <p><a href="http://jsfiddle.net/8wUg8/" rel="nofollow">working fiddle</a></p>