Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic

jquery date picker disable past dates

jquery date picker disable past dates  using -'jquery,jquery-ui,datepicker,uidatepicker,jquery-ui-datepicker'

I am trying to have a date Range select using the UI date picker.

in the from/to field people should not be able to view or select dates previous to the present day.

This is my code:

$(function() {
    var dates = $( "#from, #to" ).datepicker({
        defaultDate: "+1w",
        changeMonth: true,
        numberOfMonths: 1,
        onSelect: function( selectedDate ) {
            var option = == "from" ? "minDate" : "maxDate",
                instance = $( this ).data( "datepicker" ),
                date = $.datepicker.parseDate(
                    instance.settings.dateFormat ||
                    selectedDate, instance.settings );
            dates.not( this ).datepicker( "option", option, date );

Can some one tell me how to disable dates previous the to the present date.

asked Oct 7, 2015 by devkumargupta
0 votes

Related Hot Questions

Government Jobs Opening