input type="date"일 때, placeholder를 text로 설정하는 방법 채택완료

안녕하세요. 

 

        <label for="wr_name" class="sound_only">주문 날짜<strong>필수</strong></label>
        <input type="date" name="wr_name" value="<?php echo $name ?>" id="wr_name" required aria-required="true" class="frm_input required" placeholder="주문 날짜">

 

 

input type은 date로 설정하고, 날짜 선택 전에 보이는 칸에는 텍스트가 보여지게 하고 싶습니다.

인터넷에 검색해봐도 적절한 방법을 찾지 못해 문의드립니다.

 

input type="date"일 때, placeholder를 text로 설정하는 방법이 있을까요?

답변 1개

채택된 답변
+20 포인트
input[type="date"]:not(.has-value):before{
  color: lightgray;
  content: attr(placeholder);
}
<input type="date" placeholder="MY PLACEHOLDER" onchange="this.className=(this.value!=''?'has-value':'')">
로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

감사합니다.

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고