【问题标题】:date picker not popping up [closed]日期选择器没有弹出[关闭]
【发布时间】:2018-06-13 01:58:54
【问题描述】:

我把这个放在头上:

$(function() {
  $("#datepicker").datepicker({
    dateFormat: "DD, dd MM yy",
    minDate: "+2",
    maxDate: "+1Y"
  });
});
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
</script>


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

但是datepicker 没有出现。 textbox 出现,当我点击没有弹出。我做错了吗?

它适用于jsfiddle,但不适用于我的.php 页面。

【问题讨论】:

  • id="#datepicker" !! => id="datepicker"
  • 啊,是的,我忘记了,但是更改后仍然无法正常工作。
  • 现在检查 sn-p ,如果它现在可以在您的网站上运行,请尝试调试,检查浏览器控制台日志。
  • 控制台日志返回:style.css 加载资源失败:服务器响应状态为 404 (Not Found) (index):24 Uncaught TypeError: $(...).datepicker is不是 HTMLDocument 的函数。 ((index):24) at fire (jquery-1.12.4.js:3232) at Object.fireWith [as resolveWith] (jquery-1.12.4.js:3362) at Function .ready (jquery-1.12.4.js:3582) at HTMLDocument.completed (jquery-1.12.4.js:3617) style.css 加载资源失败:服务器响应状态为 404(未找到)跨度>
  • 我也得到了这个:GET mydomaindotcom/resources/demos/style.css net::ERR_ABORTED

标签: jquery datepicker


【解决方案1】:

<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>    
<script>
jQuery(function() {
  jQuery("#datepicker").datepicker({
    dateFormat: "DD, dd MM yy",
    minDate: "+2",
    maxDate: "+1Y"
  });
});
</script>


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

【讨论】:

  • 可能是变量冲突?
  • 是的,谢谢,我发现了冲突并对其进行了排序。现在可以了。谢谢:)
猜你喜欢
  • 1970-01-01
  • 2019-09-30
  • 2015-12-31
  • 2019-09-28
  • 1970-01-01
  • 1970-01-01
  • 2019-07-01
  • 1970-01-01
  • 2014-04-24
相关资源
最近更新 更多