jQuery 本地化调用 setdefauls 与 datepicker()

发布于 2024-12-21 10:39:58 字数 1271 浏览 2 评论 0 原文

谁能告诉我为什么会发生这种情况。

以下代码工作完美,我得到了德语的日期选择器:

<input id="foo" type="text"> pick it
<script>
      $(function() {
        $( "#foo" ).datepicker();
        $.datepicker.setDefaults( $.datepicker.regional[ "de" ] );
      });
      </script>

但是以下代码不起作用(我得到了日语的日期选择器):

<input id="foo" type="text"> pick it
<script>
      $(function() {
        $( "#foo" ).datepicker();
        $( "#foo" ).datepicker( $.datepicker.regional[ "de" ] );
      });
      </script>

这是我的包含文件:

http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js

http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js

http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/i18n/jquery-ui-i18n.min.js

旁注。根据文档 http://jqueryui.com/demos/datepicker/ 它应该可以工作。任何人都可以复制这个吗?

Can anyone tell me why this happens.

The following code works perfectly, I get the datepicker in German:

<input id="foo" type="text"> pick it
<script>
      $(function() {
        $( "#foo" ).datepicker();
        $.datepicker.setDefaults( $.datepicker.regional[ "de" ] );
      });
      </script>

But the following code doesn't work (I get the datepicker in Japanese):

<input id="foo" type="text"> pick it
<script>
      $(function() {
        $( "#foo" ).datepicker();
        $( "#foo" ).datepicker( $.datepicker.regional[ "de" ] );
      });
      </script>

Here are my include files :

http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js

http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js

http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/i18n/jquery-ui-i18n.min.js

Side note. According to the docs http://jqueryui.com/demos/datepicker/ it should work. Can anyone reproduce this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

箹锭⒈辈孓 2024-12-28 10:39:58

如果您的区域代码未被插件识别,它会设置日语...
http://jsfiddle.net/IrvinDominin/rGpCE/1/

我复制它;你可以这样改变你的代码:

<前><代码> $(函数() {
$("#foo").datepicker();
$("#foo").datepicker("option", $.datepicker.regional["de"])
});

更新的小提琴: http://jsfiddle.net/IrvinDominin/rGpCE/2/

If you your regional code is not recognized by the plugin it sets japanese...
http://jsfiddle.net/IrvinDominin/rGpCE/1/

I reproduce it; you can change your code in this way:

  $(function() {
    $("#foo").datepicker();
    $("#foo").datepicker("option", $.datepicker.regional["de"])
  });

Updated fiddle: http://jsfiddle.net/IrvinDominin/rGpCE/2/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文