我一直有很多问题要弄清楚如何摆脱与<input type="date" />
相关联的所有浏览器功能,但要将其保留为该类型,以便在移动设备上触发相应的软件键盘。
到目前为止:
::-webkit-datetime-edit-fields-wrapper { display: none !important; }
::-webkit-datetime-edit-text { display: none !important; }
::-webkit-datetime-edit-month-field { display: none !important; }
::-webkit-datetime-edit-day-field { display: none !important; }
::-webkit-datetime-edit-year-field { display: none !important; }
::-webkit-inner-spin-button { display: none !important; }
::-webkit-calendar-picker-indicator { display: none !important; }
这些似乎是与此输入类型相关联的所有值,但添加显示它们基本上都不会使输入无法使用,即没有文本或占位符可见。
答案 0 :(得分:0)
如何摆脱与
相关的所有浏览器功能<input type="date" />
任何表单元素都可以使用readonly
属性。
示例:强>
<input type="date" readonly />
任何表单元素都可以使用disabled
属性。
示例:强>
<input type="date" disabled />
对于它的价值,您还可以使用以下CSS为<input />
设置样式:
pointer-events: none;
示例:强>
input['type="date"'] {
pointer-events: none;
}
<input type="date" />