// reminder: use vuejs instead, this is still an ugly and cheap solution $(document).ready(function(){ var fieldID = 0; var wrapper = $('.field-container'); var newBtn = $('#add'); $(newBtn).click(function(e){ e.preventDefault() fieldID++; $(wrapper).append('
'); $(wrapper).append(''); //$(wrapper).append('
'); }); });