bootstrap-datepicker changeMonth月份变更事件

bootstrap-datepicker changeMonth月份变更事件,比如之前日期选择的是2020-6-6如果重新选择日期为2020-6-10那么不会触发这个事件,需要选择其他月份的日期才会触发changeMonth事件。

changeMonth事件

    //日期控件初始化
    var ops = {
        todayHighlight: true, //设置当天日期高亮
        language: 'zh-CN', //设置语言
        autoclose: true, //设置选择后自动关闭
        clearBtn: true,//清除按钮
        format: "yyyy-mm-dd",//日期格式
    };
    $("#itxst").datepicker(ops);
    $('#itxst').datepicker('setDate', new Date());
    //绑定changeMonth事件
    $('#itxst').datepicker().on('changeMonth', function (e) {
        console.log(e);
        $("#tips").html('你重新选择了月份');
    });

在线试一试