删除type = date的html5输入元素中存在的默认文本/占位符 [英] Remove default text/placeholder present in html5 input element of type=date
本文介绍了删除type = date的html5输入元素中存在的默认文本/占位符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用类型为date的html input元素,
I am using html input element with type as date,
<input type="date">
当我使用上述元素时,它会在输入内创建一个默认日期格式,即mm / dd / yyyy元件。如何删除此默认文本?
When I use above element it creates a default date format i.e. mm/dd/yyyy text within that input element. How do I remove this default text?
我尝试在我的网页上添加以下样式,但它也隐藏了所选的日期值,
I tried adding below style on my page but it is hiding the selected date value as well,
input[type=date]::-webkit-datetime-edit-text {
-webkit-appearance: none;
display: none;
}
input[type=date]::-webkit-datetime-edit-month-field{
-webkit-appearance: none;
display: none;
}
input[type=date]::-webkit-datetime-edit-day-field {
-webkit-appearance: none;
display: none;
}
input[type=date]::-webkit-datetime-edit-year-field {
-webkit-appearance: none;
display: none;
}
推荐答案
::-webkit-datetime-edit-year-field:not([aria-valuenow]),
::-webkit-datetime-edit-month-field:not([aria-valuenow]),
::-webkit-datetime-edit-day-field:not([aria-valuenow]) {
color: transparent;
}
这篇关于删除type = date的html5输入元素中存在的默认文本/占位符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文