How to change the mask of an input type date

Asked

Viewed 407 times

-9

How do I solve this problem ?

I want to remove this "dd/mm/yyyy"

inserir a descrição da imagem aqui

Quero remover este "dd/mm/aaaa"

  • You just want to remove the content and leave it empty or want to show something?

  • 1

    blocks the code ?

  • Just leave it empty

1 answer

1

You can "hide" the mask by setting the default text color to transparent, and then putting the black color back when the input is focused or valid. It worked on Chrome and Firefox, IE doesn’t seem to accept type=date, but somehow it also becomes empty and when you click on input or write something the text turns black.

input[type=date]::-webkit-datetime-edit{ color: transparent; }
input[type=date]:valid::-webkit-datetime-edit{ color: #000; }
input[type=date]:focus::-webkit-datetime-edit{ color: #000; }

input[type=date]{ color: transparent; }
input[type=date]:valid{ color: #000; }
input[type=date]:focus{ color: #000; }
<input type="date" required>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.