Trigger function when date is selected with jQuery UI datepicker

inkwai picture inkwai · Jul 23, 2012 · Viewed 148.5k times · Source

How can I trigger onSelect event when I select a selected date on jQuery UI datepicker?

Answer

Tats_innit picture Tats_innit · Jul 23, 2012

Working demo : http://jsfiddle.net/YbLnj/

Documentation: http://jqueryui.com/demos/datepicker/

code

$("#dt").datepicker({
    onSelect: function(dateText, inst) {
        var date = $(this).val();
        var time = $('#time').val();
        alert('on select triggered');
        $("#start").val(date + time.toString(' HH:mm').toString());

    }
});