Marc Sommerson
Marc Sommerson

Reputation: 99

Latest jquery datepicker, change default date

I know this question has been asked a lot, but I could find a solution that works for the latest version which by default shows current date on open. Any ideas how to change this to some static date (2011.09.21) ?

I wrote this as a seperate script:

<script>
function(){
$(".single-product .i2").datepicker({
     defaultDate: '2011/09/09'
 });
};
</script>

But it still loads default date.

Upvotes: 0

Views: 72

Answers (2)

j08691
j08691

Reputation: 207901

Use the defaultDate parameter:

$("#datepicker").datepicker({
    defaultDate: '09/21/2011'
});

jsFiddle example

Upvotes: 1

Alexander Elgin
Alexander Elgin

Reputation: 6956

$('.selector').datepicker('setDate', new Date(2011, 8, 21))

Upvotes: 0

Related Questions