2

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?

4

1 回答 1

3

将您的两个日期选择器实例更改为:

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

实例化日期选择器后,您使用的代码可用于更改选项。上面的代码在您实例化它时设置选项。

jsFiddle 示例

于 2012-08-23T15:39:31.343 回答