单击输入时打开日期选取器



我在这里和目前都有这个输入类型日期,日期选择器只会在用户单击其字段中的向下箭头按钮后显示。我想发生的是,每次用户单击输入字段时打开日期选择器。

<input type="date" id="date_of_purchase" name="date_of_purchase" class="input-field input-date" placeholder="Inköpsdatum">

来自 jQuery UI 页面的日期选择器:

<!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>

编辑

创建回退到 jquery 的日期选取器

最新更新