﻿function add() {
    var newEle = template.clone(true);
    var name = "uploads["+counter+"]";
    var id = "uploads_"+counter;
    newEle.children().each(function() {
        if(this.tagName === "INPUT") {
            var thees = $(this);
            thees.attr('id',id);
            thees.attr('name',name);
        }
    });
    $('#uploadsContainer').append(newEle);
    newEle.append('<input type="button" class="remove" onclick="remove(this);" value="Remove" />')
    counter++;
}

function remove(ele) {
    $(ele).parents('.upload').remove();
}
