Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> HTML

Không hiển thị placeholder cho input type="date" trong HTML5. Cách khắc phục?

Để hiển thị placeholder, bạn có thể dùng cách sau:

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

Hoặc sử dụng CSS:

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