<!doctype html>
<html>
    <body>
        {% block radrest_content %}
        {% endblock %}
        <script src="{{ asset('js/jquery.js') }}"></script>
        <script>
            $('form [data-prototype]').each(function() {
                var $this = $(this);
                var proto = $(this).data('prototype');
                var $add = $('<span>+ Add</span>');
                $this.append($add);
                $add.on('click', function() {
                    var field = proto.replace(/\[__name__\]/g, '[]');
                    var field = field.replace(/__name__(label__)?/g, $this.find(':input').length);
                    $add.before(field);
                });
            });
            $('form [data-prototype] .form-group').each(function() {
                var $this = $(this);
                var $delete = $('<span>x</span>');
                $this.append($delete);
                $delete.on('click', function() {
                    $this.remove();
                });
            })
        </script>
    </body>
</html>

Add js to manage form field collections
Add js to manage form field collections
