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.