Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

88
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!