1 回答
TA贡献1776条经验 获得超12个赞
请注意,我在头部添加了 jquery-ui。和 style.css。我还更改了您编写的函数:
$( "#datepicker" ).datepicker({dateFormat: "dd/mm/yy"});
现在它应该是这样的:
<!doctype html>
<html>
<head>
<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({dateFormat: "dd/mm/yy"});
} );
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker"></p>
</body>
</html>
阅读更多:https ://api.jqueryui.com/datepicker/#option-dateFormat 代码笔:https ://codepen.io/Elnatan/pen/mdPdBEG
添加回答
举报