html - 如何使整个 HTML 日期字段可点击?
问题描述
我在注册表单中使用 HTML 日期字段,我使用 Laravel 7 来制作我的应用程序。在我的“注册”刀片视图中,我有一个 HTML 日期字段,我想在单击整个日期部分时打开日历。我怎样才能做到这一点?目前,单击小日历图标时会打开日历。请帮忙。
在我看来:
<div class="col-sm-4 col-lg-4 col-md-4">
<label for="start_date">Start Date</label><span class="required">*</span>
<input type="date" class="form-control" id="start_date" name="start_date" value="{{ old('start_date') }}" required>
</div>
解决方案
您可以实现如下所需的功能。
<style>
.form-control input {
border: none;
box-sizing: border-box;
outline: 0;
padding: .75rem;
position: relative;
width: 100%;
}
input[type="date"]::-webkit-calendar-picker-indicator {
background: transparent;
bottom: 0;
color: transparent;
cursor: pointer;
height: auto;
left: 0;
position: absolute;
right: 0;
top: 0;
width: auto;
}
</style>
<div class="col-sm-4 col-lg-4 col-md-4">
<label for="start_date">Start Date</label><span class="required">*</span>
<input type="date" class="form-control" id="start_date" name="start_date" value="{{ old('start_date') }}" required>
</div>
推荐阅读
- javascript - 通过 jQuery ajax() 将 HTML 作为数据传递 & 在 URL 中更改为 `&`
- javascript - 发生违反约束时显示警报消息
- mysql - 带和不带窗口功能的最小值和最大值
- react-native - react-native-reanimated 如何处理布局更新?
- python - 为什么当我没有为我的 openGLWidget 创建额外的类时 glRotate 只工作一次?
- php - 如何从返回多个字符串的 PHP 数组中提取一行
- haskell - 在 Haskell 中满足某个要求时突破 If-Then
- visual-studio - VS 2019 中的终端在哪里?
- docker - 如何修复詹金斯管道中的“过程显然从未开始......”错误?
- excel - 在 Excel 中,我如何通过一行代码检查下拉选择的值是什么。然后,我如何检查该值与另一个值