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

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

QA

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

답변 1

본문

안녕하세요. 

 

        <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

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':'')">
답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
  • 질문이 없습니다.
전체 0
© SIRSOFT
현재 페이지 제일 처음으로