Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display only years in JQuery UI Calendar

how can i show or display only years in JQuery UI Calendar? I need to do a dropdown list with years without taking care the month, just years.

Thanks in advance

like image 767
Leandro Bardelli Avatar asked Jan 25 '26 07:01

Leandro Bardelli


1 Answers

    $( "#datepicker" ).datepicker({
        changeMonth: false,
        changeYear: true
    });

http://jqueryui.com/demos/datepicker/#dropdown-month-year

Alternatively, if you just want a list of years, you can generate it without jQueryUI:

var i,yr,now = new Date();
for (i=0; i<10; i++) {
    yr = now.getFullYear()+i; // or whatever
    $('#select-year').append($('<option/>').val(yr).text(yr));
};
like image 82
Blazemonger Avatar answered Jan 28 '26 15:01

Blazemonger