Paul-DS / bootstrap-year-calendar

[DEPRECATED] A fully customizable year calendar widget, for boostrap !
Apache License 2.0
294 stars 243 forks source link

Issues with yearChanged #237

Open thaqiftaher opened 5 years ago

thaqiftaher commented 5 years ago

Hi there,

I wanted to store the year every time the yearChanged is fired. This is the my code:

yearChanged: function(e)
        {
            var tahun = $('#calendar').data('calendar').getYear();
            alert(tahun);
        },

However, the calendar is not displayed. When i opened the console, this is the error:

Uncaught TypeError: Cannot read property 'getYear' of undefined
    at HTMLDivElement.yearChanged (conv-calendar.html:33)
    at HTMLDivElement.dispatch (jquery-2.2.3.min.js:3)
    at HTMLDivElement.r.handle (jquery-2.2.3.min.js:3)
    at Object.trigger (jquery-2.2.3.min.js:4)
    at HTMLDivElement.<anonymous> (jquery-2.2.3.min.js:4)
    at Function.each (jquery-2.2.3.min.js:2)
    at n.fn.init.each (jquery-2.2.3.min.js:2)
    at n.fn.init.trigger (jquery-2.2.3.min.js:4)
    at b._triggerEvent (bootstrap-year-calendar.min.js:7)
    at b.setYear (bootstrap-year-calendar.min.js:7)

Is there any way to achieve this?