Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

87
Vistas
Manipulations of jquery datepicker disappear after interacting with datepicker

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.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda