Wednesday, March 13, 2019

Add/remove placeholder to date field (SASS/CSS)

Use something similar to this:
.date input[type='date']:empty:after {
    @include media-breakpoint-down(md) {
      content: attr(placeholder);
      position: absolute;
    }
  }
To remove placeholder, you need to make sure the "value" property is set in the input field:
.date input[type='date']:not([value=""]):after {
    @include media-breakpoint-down(md) {
      content: ' ';
    }
  }

No comments:

Post a Comment