ASP.NET MVC datetimepicker change event

ASP.NET MVC datetimepicker change event

In ASP.NET MVC Application, we needed a solution to trigger an change event only if the date changed. (bootstrap-datetimepicker.min.js onchange)

You can use the following code snippet to trigger the change event of the datetimepicker field

$('#date').datetimepicker().on('dp.change', function (e) fires whenever a date is selected.

To detect the change event, use :

<script type="text/javascript">

    $(document).ready(function () {
        $('#date').datetimepicker().on('dp.change', function (e) {
            var val1 = $("#date").val();
            console.log("Date : " + val1);



tag : bootstrap-datetimepicker.min.js onchange,ASP.NET MVC datetimepicker

That will only fire change for a new value.

It's triggered when the "date" field is changed using the keyboard.

How to use datettimepicker in ASP.NET MVC


<div class="col-12 col-md-6">
    <div class="form-group">
        <div class="cal-icon">
            @Html.TextBoxFor(m =>, new { @class = "form-control datetimepicker", type = "text" })
            @Html.ValidationMessageFor(m =>