how to fix 'Uncaught TypeError: $(...).datepicker is not a function'
how to fix 'Uncaught TypeError: $(...).datepicker is not a function'
我想创建日期选择器,但它不起作用
$("#datepicker").datepicker();
Uncaught TypeError: $(...).datepicker is not a function
我期待日历,但显示错误
您的脚本中是否同时包含 jQueryui 和 jQuery?没有源代码或有关您正在做的事情的更多信息,问题有点模糊。
这直接来自 jQueryUI 的网站:https://jqueryui.com/datepicker/
此外,请确保 jQuery 没有在您的代码中包含两次,因为 post 建议: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>
希望对您有所帮助!
我想创建日期选择器,但它不起作用
$("#datepicker").datepicker();
Uncaught TypeError: $(...).datepicker is not a function
我期待日历,但显示错误
您的脚本中是否同时包含 jQueryui 和 jQuery?没有源代码或有关您正在做的事情的更多信息,问题有点模糊。
这直接来自 jQueryUI 的网站:https://jqueryui.com/datepicker/
此外,请确保 jQuery 没有在您的代码中包含两次,因为 post 建议: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>
希望对您有所帮助!