Append cloned elements and increment attributes
A possible solution to http://stackoverflow.com/questions/34164152/jquery-clone-form-increment-all-attributes-of-name-class-id-data-id-etc
by bizamajig
HTML
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<!-- Container which will hold your elements -->
<div class="container">
<!-- Original element, this block will be duplicated -->
<div class="element">
<input id="input1id" class="input1class" name="input1name" />
</div>
</div>
<button type="button" id="trigger">Make Copy</button>
JavaScript
$(document).ready(function(){
var elementCopy = '<div class="element">'+
' <input id="input@@id" class="input@@class" name="input@@name" />'+
' </div>';
$('#trigger').on('click', function() {
var count = $('.element').length;
var counter = count + 1;
var clone = elementCopy.replace(/\@\@/g, counter);
$('.container').append(clone);
})
});