jQuery DateRangePicker的onchange事件不触发

时间:2019-02-06 03:42:47

标签: bootstrap-daterangepicker

我正在向用户显示日历,他们可以在其中选择日期范围。

这是我的Javascript

    <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js"></script>
<link href="css/daterangepicker.css" rel="stylesheet">
<script src="js/jquery.daterangepicker.min.js"></script>

<script>
    $(document).ready(function () {
        var startDate= "hi";
        var endDate = "there";
        console.log("Callback has been called!");
        $('#date-range12').dateRangePicker(
            {
                inline: true,
                container: '#date-range12-container',
                alwaysOpen: true,
                singleMonth: true

            },
            function(start, end) {
                console.log("Callback has been called!");
                    console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));

                startDate = start;
                endDate = end;
            });
    });
</script>

这是我的HTML

<div id='MSDSBox' style="display:block;" class="wrapper-box">
    <input id="date-range12" size="40" value="" type="hidden">
    <div id="date-range12-container" ></div>
</div>

我注意到的是console.log语句从不触发。我什至尝试过找到here的示例。

0 个答案:

没有答案