Reputation: 153
I can't change the date format.. about to tear my hair out. Searched the API and tried it all. Tried everything
<body>
<p>Date:
<input type="text" id="datepicker" />
</p>
</body>
$(function () {
$(".selector").datepicker({
dateFormat: 'dd-mm-yy'
});
$("#datepicker").datepicker({
showOn: "button",
buttonImage: "calendar_icon120121018-7997-10s714y-0_original.png",
buttonImageOnly: true
});
});
Upvotes: 2
Views: 1599
Reputation: 33153
I see you have copy-pasted this line from the API:
$( ".selector" ).datepicker({ dateFormat: 'dd-mm-yy' });
.selector
is a placeholder for the element you apply the datepicker to, in this case #datepicker
. It's just an example, you have to modify it to fit into your own code.
Put the dateFormat
option to the actual datepicker initializer, just like all the other options:
$( "#datepicker" ).datepicker({
dateFormat: 'dd-mm-yy',
showOn: "button",
buttonImage: "calendar_icon120121018-7997-10s714y-0_original.png",
buttonImageOnly: true
});
Upvotes: 2