John
John

Reputation: 329

How to set default date in timepicker

Here is a simple timepicker to jQuery UI's datepicker

<script type="text/javascript">
/* <![CDATA[ */
    $(function() {
              $('#pickerfield').datetime({
                                userLang    : 'en',
                                americanMode: true,

                            });
        });
/* ]]> */
</script>

<input id="pickerfield" type="text" value="" />

Now I want to know how to add default date more than 2 days and disable all previous dates

Update:- I am talking about time picker like this Time picker

Upvotes: 0

Views: 2105

Answers (2)

Jasper
Jasper

Reputation: 75993

You can just pass in options to the .datetimepicker() function (I noticed when making my demo that datetime didn't seem to work) for the jQuery UI Datepicker:

$(function() {
    $('#datepicker').datetimepicker({
        userLang     : 'en',
        americanMode : true,
        minDate      : +2,
        defaultDate  : +4
    });
});

Here is a demo: http://jsfiddle.net/MG6Mb/2/

Upvotes: 0

Jaspreet Chahal
Jaspreet Chahal

Reputation: 2750

I think you are looking for something like this http://jsfiddle.net/MG6Mb/

Upvotes: 1

Related Questions