Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

82
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda