I've just created an dynamic HTML form and two of its fields are of type date. Those two fields are posting their data into two arrays. I have 2 issues:

a) The array data are not printed when I press the button.

b) Since I created the arrays to store the data, my dynamic form doesn't seem to be fully functional. It only produces new fields when I press the first "Save entry" button on the form. It also doesn't delete any fields.

My code is:

```
$(document).ready(function () {
    $('#btnAdd').click(function () {
        var $address = $('#address');
        var num = $('.clonedAddress').length;
        var newNum = new Number(num + 1);
        var newElem = $address.clone().attr('id', 'address' + newNum).addClass('clonedAddress');

        newElem.children('div').each(function (i) {
            this.id = 'input' + (newNum * 10 + i);
        });
        newElem.find('input').each(function () {
            this.id = this.id + newNum;
            this.name = this.name + newNum;
        });

        if (num > 0) {
            $('.clonedAddress:last').after(newElem);
        } else {
            $address.after(newElem);
        }

        $('#btnDel').removeAttr('disabled');

    });

    $('#btnDel').click(function () {
        $('.clonedAddress:last').remove();
        $('#btnAdd').removeAttr('disabled');
        if ($('.clonedAddress').length == 0) {
            $('#btnDel').attr('disabled', 'disabled');
        }
    });
    $('#btnDel').attr('disabled', 'disabled');
});
$(function () {
    $("#datepicker1").datepicker({
        dateFormat: "yy-mm-dd"
    }).datepicker("setDate", "0");
});

var startDateArray = new Array();
var endDateArray = new Array();

function intertDates() {
    var inputs = document.getElementsById('datepicker1').value;
    var inputsend = document.getElementsById('datepicker2').value;
    startDateArray[startDateArray.length] = inputs;
    endDateArray[endDateArray.length] = inputsend;
    window.alert("Entries added!");
}

function show() {
    var content = "<b>Elements of the arrays:</b><br>";
    for (var i = 0; i < startDateArray.length; i++) {
        content += startDateArray[i] + "<br>";
    }
    for (var i = 0; i < endDateArray.length; i++) {
        content += endDateArray[i] + "<br>";
    }
}

```

[JSFIDDLE](http://jsfiddle.net/stelios13/G24xB/)

Any ideas? Thanks.