Can't add datepicker option?

I have a form wich dynamically creates a new row with a couple of form inputs. One of the inputs has a datepicker attached to it. I just managed with the help from here, to make this work. Except there is one problem left, as soon when i want to add options to the datepicker, it stops working...

Working fiddle: http://jsfiddle.net/HermesTrismegistus/Bt9eU/

And a not working fiddle: http://jsfiddle.net/HermesTrismegistus/TTNEP/

Its about this line:

$(".datepick").datepicker();

When i add the options to it.. It seems to stop functioning.

$(".datepick").datepicker("option", "dateFormat", "dd-mm-yy");

Does someone knows the solution to this?

Answers


Change both of your datepicker instances to:

$(".datepick").datepicker({ dateFormat: "dd-mm-yy" });

The code you were using works for changing options after you have instantiated a datepicker. The above code sets options when you instantiate it.

jsFiddle example


Need Your Help

memcached-session-manager on AWS

amazon-web-services memcached session-management session-replication amazon-elasticache

I've got a website running on Amazon Web Services that is deployed using Elastic Beanstalk and runs on a minimum of 2 EC2 micro instances. An auto scaling policy is in place, so that it can scale u...

Return database scalar value using nlog

c# nlog

We are designing a logging mechanism using Nlog for our application. There is a common value which we need to hold in the database for particular session which is generated by Nlog.