NoWar
NoWar

Reputation: 37633

Bootstrap Datetimepicker change event is not firing

Bootstrap Datetimepicker change event is not firing without errors. Any clue?

https://github.com/Eonasdan/bootstrap-datetimepicker/blob/master/docs/Events.md

$('#datetimepickerStart').datetimepicker();

$('#datetimepickerStart').datetimepicker().on('change', function (ev) {
                alert('!!!');

});

Upvotes: 6

Views: 16303

Answers (3)

Shuhad zaman
Shuhad zaman

Reputation: 3390

following method worked for me. I am using bootstrap datepicker

$('.date-range-filter').on('change dp.change', function(e){
    alert('changed');
    });

Upvotes: 2

Darshan Jain
Darshan Jain

Reputation: 838

<div class="input-group date" id="dateOfBirth" data-target-input="nearest">
    <input type="text" class="form-control datetimepicker-input"
        data-target="#dateOfBirth" placeholder="Select DOB.." />
    <div class="input-group-append" data-target="#dateOfBirth"
        data-toggle="datetimepicker">
        <div class="input-group-text"> <i class="fa fa-calendar"> </i>
        </div>
    </div>
</div>



$("#dateOfBirth").on("change.datetimepicker", ({date}) => {
    var dob = $("#dateOfBirth").find("input").val();
    console.log(dob);
})

This worked for me.

Upvotes: 3

NoWar
NoWar

Reputation: 37633

I found the solution

  $('#datetimepickerStart').datetimepicker().on('dp.change', function (event) {
                alert('!!!');
            });

Upvotes: 16

Related Questions