2

enter image description here

code:

$(function() {
        $("#businessDatepicker").datepicker({
            changeMonth: true,
            changeYear: true,
        });
    });

How to get month and year change event?

Bhumi Shah
  • 9,323
  • 7
  • 63
  • 104
  • what do you mean by **get month and year change event**? – madalinivascu Jun 20 '18 at 12:46
  • 1
    Possible duplicate of [Detect change to selected date with bootstrap-datepicker](https://stackoverflow.com/questions/17009354/detect-change-to-selected-date-with-bootstrap-datepicker) – peeebeee Jun 20 '18 at 13:06

1 Answers1

3
$(function() {
        $("#businessDatepicker").datepicker({
            changeMonth: true,
            changeYear: true,
            onChangeMonthYear: function () {
                alert('y');
            }
        });
    });
Thomas Ayoub
  • 29,063
  • 15
  • 95
  • 142
  • 1
    While this code snippet may solve the question, [including an explanation](http://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. – Derek Brown Jun 20 '18 at 15:14