$(document).ready(function () {
    //add and remove vehicle fields
    var addButton = $('#add-field'); //Add button selector
    var wrapper = $('.added-fields'); //Input field wrapper
    var commission = $('#standard-commission').val();

    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 Category Name:</div>\n' +
        '        <div class="guestDetails_input">\n' +
        '            <input type="text" name="name[]" size="40px" class="input-text-height">\n' +
        '        </div>\n' +
        '    </div>\n' +
        '    <div class="guestDetails_input">\n' +
        '        <div class="guestDetails_inputLabel">Enter Commission(%).:</div>\n' +
        '        <div class="guestDetails_input">\n' +
        '            <input type="text" name="commission[]" class="commission-amount"   size="20px" 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
        $('.commission-amount').val(commission);
    });
    //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
    });
});
