如何在 HTML5 中為輸入型別=“date”欄位展示佔位符? 如何解決?


要顯示它,請使用以下內容 −

<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-3-2020

4K+ 閱讀量

開啟你的職業生涯

完成課程獲得認證

開始
廣告
© . All rights reserved.