'Attach Event to Bootstrap DatetimePicker

Using Javascript, how can I attach an event listener for when the datetime has been changed in the Bootstrap DatetimePicker (Homepage)

<script>
    $(function(){
        document.getElementById('dtp1').addEventListener('change',function(e){
            //Do Something
        });
    });
</script>

However the above function isn't getting fired when I change the date either by using keyboard or the mouse (point and click).

The HTML Looks like this:

<div class="form-group">
    <div class='input-group date' id='dtp1'>
        <span class="input-group-addon" id="basic-addon1">Date</span>
        <input type='text' class="form-control"/>
        <span class="input-group-addon">
            <span class="glyphicon glyphicon-calendar"></span>
        </span>
    </div>
</div>

If someone would advise the correct way to do this, I would be most appreciative.



Solution 1:[1]

I worked out a solution that achieves a result.

<script>
    $("#dtp1").on("dp.change",function (e) {
        //Do Something
    });
</script>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nicholas Hamilton