$(document).ready(function () {
    //add and remove vehicle fields
    var addButton = $('#add-url-policy-document'); //Add button selector
    var wrapper = $('.added-fields-url'); //Input field wrapper
    var x = 1;
    var fieldHTML = '<div class="">' +
        '<button type="button" id="remove-button"> <i class="fa fa-trash"></i> </button>' +
        '<div class="guestDetails_input">\n' +
        '        <div class="guestDetails_inputLabel">Enter File Name:<span class="error">*</span></div>\n' +
        '        <div class="guestDetails_input">\n' +
        '            <input type="text" name="file-name-url[]" size="20" class="input-text-height">\n' +
        '        </div>\n' +
        '    </div>\n' +
        '    <div class="guestDetails_input">\n' +
        '        <div class="guestDetails_inputLabel">Enter File URL here to Upload:<span class="error">*</span></div>\n' +
        '        <div class="guestDetails_input">\n' +
        '            <input type="text" size="40"  name="url-name[]" class="input-text-height">\n' +
        '        </div>\n' +
        '    </div>\n' +
        '    <div class="guestDetails_inputDivider input_divider1"></div>';

    //Once add button is clicked
    $(addButton).click(function(){
        x++; //Increment field counter
        $(wrapper).append(fieldHTML); //Add field html
    });
    //Once remove button is clicked
    $(wrapper).on('click', '#remove-button', function(e){
        e.preventDefault();
        $(this).parent('div').remove(); //Remove field html
        x--; //Decrement field counter
    });
});
