Color Shadow
Color Shadow

Reputation: 305

Restrict datepicker dates

Currently I have this javascript code for my date picker

<script type="text/javascript">
    $(function() {
        $("#datePicker").datepicker();
        $("#<%=TextBox1.ClientID %>").datepicker();
    });
</script>

How to make my date picker not accept the past date? Thank you.

Upvotes: 2

Views: 205

Answers (2)

Mayank Pathak
Mayank Pathak

Reputation: 3681

Try this

$("#datepicker").datepicker({ minDate: 0 });

minDate option does this work..

Upvotes: 0

Thousand
Thousand

Reputation: 6638

this greys out (and disables the selection) of any past date:

 $(function () {
            $("<%=TextBox1.ClientID %>").datepicker(
            {
             minDate: +0,
            });
        });

Upvotes: 1

Related Questions