Fetz
Fetz

Reputation: 53

Jquery datepicker, select year

I would like to have more than 11 dates to choose from, instead I'd like to have all possible years in one single dropdown

This is my code:

$( function() {
    $( "#data" ).datepicker({
        changeMonth: true,
        changeYear: true,
        minDate: "-100Y",
        maxDate: "-18Y"
    });
} );

I would like to have full selection from 1917 to 1999

date picker

Upvotes: 0

Views: 2174

Answers (1)

Serge K.
Serge K.

Reputation: 5323

Try this :

$(function() {
  $("#data").datepicker({
    changeMonth: true,
    changeYear: true,
    yearRange: "-100:-18"
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<input type="text" id="data" />

Upvotes: 2

Related Questions