【问题标题】:Why does this datepicker example from jqueryui's site no longer work?为什么 jqueryui 网站上的这个 datepicker 示例不再起作用?
【发布时间】:2014-09-23 18:15:24
【问题描述】:

为什么这段代码不再有效?这是从 jquery ui 示例页面复制和粘贴的。以前可以正常工作,现在不行了。

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script>
  $(function() {
    $( "#datepicker" ).datepicker();
  });
  </script>
</head>
<body>

<p>Date: <input type="text" id="datepicker"></p>


</body>
</html>

【问题讨论】:

  • 对我有用,除了样式(出于显而易见的原因..)什么不适合你?另外,您是否看到任何控制台错误?请注意,// 不适用于 file:/// 协议。您需要明确使用http://https://
  • 定义不起作用。
  • jsfiddle.net/bozrxa30/1 工作得很好

标签: jquery jquery-ui jquery-ui-datepicker


【解决方案1】:

对我来说很好用。检查此链接jsfiddle 以查看工作示例。

您必须包含所有必要的脚本和样式。看看 jsfiddle 配置面板中的External Ressources

您可以删除:

<link rel="stylesheet" href="/resources/demos/style.css">

没有必要让日期选择器工作。这只是演示的样式表!

希望有用!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-06-12
    • 2022-01-08
    • 2011-04-10
    • 1970-01-01
    • 1970-01-01
    • 2019-04-07
    • 1970-01-01
    • 2014-06-22
    相关资源
    最近更新 更多