Skip to content

Instantly share code, notes, and snippets.

@artemijeka
Last active March 29, 2023 13:56
Embed
What would you like to do?
<input type="date" oninput="inputHandler(this)">

<!-- Это для передачи placeholder в ::after псевдокласс чтобы эмитировать placeholder -->
input[type='date']::after,
input[type='time']::after {
  content: attr(placeholder);
  height: 100%;
  display: flex;
  align-items: center;
  background: white;
  pointer-events: none;
  position: absolute;
}

<!-- Это невидимая плёнка для того чтобы datepicker/timepicker всплывал при нажатии в любом месте -->
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  width: 100%;
  height: 100%;
  background: transparent;
  color: transparent;
  cursor: pointer;
  height: auto;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  top: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment