my goal is a datepicker which only displayes the years. My datepicker :
$( "#datepicker" ).datepicker({
defaultDate: new Date(now.getFullYear(), now.getMonth() - 1, 1),
changeMonth: false,
changeYear: true,
regional:"de",
dateFormat: 'yy',
beforeShow: function(el, dp) {
$('#ui-datepicker-div').toggleClass('hide-calendar', $(el).is('[data-calendar="false"]'));
},
onChangeMonthYear: function(year, month, instance) {
this.month = month;
this.year = year;
SelectDataPanel.submitRequest();
SelectDataPanel.saveState();
},
});
Theoretically I could use
.ui-datepicker-month {
display: none;
}
to achieve this. But I want that the functionality and thus the style of the datepicker is changeable. Thats why I tried to used this:
var all = document.getElementsByClassName('ui-datepicker-month');
for (var i = 0; i < all.length; i++) {
console.log("i = " + all[i])
all[i].style.display = 'none';
}
which I than can execute in a function. When I refresh my side it looks how it should, but when I interact with the datepicker, months become displayed again. Thats my problem.