Search code examples
javascriptjquery-uijquery-ui-datepicker

JqueryUI Datepicker doesn't put selected date into HTML


I just managed to display a datepicker but after I select a date it doesn't go on the input and the date remains width the default placeholder:

HTML

<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

<input type="date" id="data" name="data" value="" class="form-control">

Javascript

 //JQueryUI
$( function() {
    $( "#data" ).datepicker({
        changeMonth: true,
        changeYear: true,
        yearRange: "-100:-0"
    });
} );

Solution

  • Try this, input type = date don´t work.

    <input type="text" id="data" name="data" value="" class="form-control">