jQuery UI: Date Picker

Date Picker

by Renilson Meneguci

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/mint-choc/jquery-ui.css">
<div class="demo">

<p>Data Normal: <input id="datepicker" class="datepicker" type="text"></p>

</div><!-- End demo -->
Campos dinamicos:
<div id="datas">

</div>

<div style="display: none;" class="demo-description">
<p>The datepicker is tied to a standard form input field.  Focus on the input (click, or use the tab key) to open an interactive calendar in a small overlay.  Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close. If a date is chosen, feedback is shown as the input's value.</p>
</div><!-- End demo-description -->

CSS

/*
    Add custom styling or use existing jQuery UI themes

    REFERENCE: jQuery UI themes, http://blog.jqueryui.com/
*/

JavaScript

$('body').on('focus',".datepicker", function(){
    $(this).datepicker();
});

$(document).ready(function(){
 for (var i = 0; i < 5; i++) {//Coloquei o i como 5 apenas para testes
                var new_date = new Date();
                new_date.setMonth(new_date.getMonth() + i);
                $("#datas").append("<div class='col-xs-4'> <label>Vencimento - parcela " + parseInt(i + 1) + "</label> <input type='text' class='datepicker' name='DataVencimentoParcela[]' id='DataVencimentoParcela" + parseInt(i + 1) + "' value='" + $.datepicker.formatDate('dd/mm/yy', new_date) + "' class='form-control' />");                   
            };
});