0

i want to configure jQuery UI that they never set date who already gone. means only futurewise date allowed or the value i want to set is now. means current [today]'s date.

$("#datepicker").datepicker({ minDate : new Date(Date.now()), defaultDate: new Date(Date.now()) });

how i can set default date because code i posted not worked

1 Answer 1

1
<script type="text/javascript">
var d=new Date();
var today = (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear();
$(function() {               
    $("#birthdate" ).datepicker({
        defaultDate: today
    });
});
</script>
Sign up to request clarification or add additional context in comments.

1 Comment

It should be d.getDate() and not d.getDay(). getDay() returns the day of the week (0 to 6). getDate() returns the day of the month.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.