HTML5 中不显示输入类型为“日期”字段的占位符。如何解决?


要显示它,请使用以下内容 −

<input placeholder = "Date" class = "textbox-n" type = "text" onfocus = "(this.type = 'date')"  id = "date">

您还可以使用 CSS −

input[type="date"]::before{
   color: #ffffff;
   content: attr(placeholder) ": ";
}
input[type="date"]:focus::before {
   content: "" !important;
}

更新于: 04-03-2020

4K+ 次观看

开启您的职业生涯

完成课程获得认证

开始
广告
© . All rights reserved.