【问题标题】:how to fix 'Uncaught TypeError: $(...).datepicker is not a function' [closed]如何修复“未捕获的 TypeError:$(...).datepicker 不是函数”[关闭]
【发布时间】:2019-12-13 23:37:13
【问题描述】:

我想创建日期选择器,但它不工作

$("#datepicker").datepicker();

未捕获的类型错误:$(...).datepicker 不是函数

我期待日历,但它显示错误

【问题讨论】:

标签: javascript jquery datepicker jquery-ui-datepicker uidatepicker


【解决方案1】:

您的脚本中是否同时包含 jQueryui 和 jQuery?没有源代码或您正在做什么的更多信息,问题有点模糊。

这是直接取自 jQueryUI 的网站:https://jqueryui.com/datepicker/

另外,请确保 jQuery 没有像这篇文章建议的那样在您的代码中包含两次:jQuery UI " $("#datepicker").datepicker is not a function"

可能重复:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Datepicker - Default functionality</title>
  <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>
  $( function() {
    $( "#datepicker" ).datepicker();
  } );
  </script>
</head>
<body>
 
<p>Date: <input type="text" id="datepicker"></p>
 
 
</body>
</html>

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 2019-08-21
    • 1970-01-01
    • 2016-01-21
    • 1970-01-01
    • 2014-10-03
    • 1970-01-01
    • 1970-01-01
    • 2017-01-26
    • 2017-05-15
    相关资源
    最近更新 更多