JSFiddle - React, Tailwind, and code Playground

by bigdave

HTML

<div class="demo">
    <p>Date: <input type="text" id="datepicker"></p>
</div>

JavaScript

// Changing '.change' to '.blur' in the code immediately below also works
$(function() {
    $( "#datepicker" ).datepicker();
}).change(function() {
    alert("Change event caught");
});

// Fix for IE8 keyboard input not triggering change
$(document).ready(function() {
    $('.hasDatepicker').blur(function(event) {
        alert("Blur event caught");
        event.stopPropagation();
        $(this).trigger('change');
    });
});