0

My datepicker is showing the default format mm/dd/yy even after changing the format to yy-mm-dd

This is my script.js

$(function(){
 $( "#date" ).datepicker( "option", "dateFormat", "yy-mm-dd");
 $( "#date" ).datepicker();
})

Please help.

1
  • Why are you calling datepicker twice? That's most certainly the problem. Commented Apr 10, 2013 at 14:57

1 Answer 1

1

Try this one:

$( "#date" ).datepicker({dateFormat: 'yy-mm-dd'});

You are calling the datepicker twice. The second time without any options, so it is called with its default options and seems to override the first one

Here's a fiddle working: http://jsfiddle.net/qG4PC/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.