The placeholder attribute does not work with the input type Date, so place any value as a placeholder in the input type Date. You can use the onfocus=”(this.type=’date’) inside the input filed. Because you are required to have a custom placeholder value for input type “date”, and you have a drop-down calendar where the user can select the date from.
Syntax:
Below example illustrates the above approch:
Example 1:
Output: 
Note: After clicking on the left field, we get the dd/mm/yyyy box, and we get the calendar drop-down menu after clicking on it again. This is because the input box is actually a “text” input, but on clicking on it (i.e. focusing on it), we get the data type input. But the right field is normal text input filed.
Example 2: When you lose the focus on the date the date field changes back to a text field.
- As we can see, we can modify the placeholder text as needed. On one click, we get the standard date input field, and we can enter the date:

- After entering the date, it looks as follows:

- Upon losing focus, it changes back to a text field due to the onblur event we have introduced:

Recommended Posts:
![]()
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the «Improve Article» button below.
Please complete the security check to access codepen.io
Why do I have to complete a CAPTCHA?
Completing the CAPTCHA proves you are a human and gives you temporary access to the web property.
What can I do to prevent this in the future?
If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.
If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.
Another way to prevent getting this page in the future is to use Privacy Pass. You may need to download version 2.0 now from the Chrome Web Store.
Cloudflare Ray ID: 538a6d41ba47c290 • Your IP : 78.85.5.224 • Performance & security by Cloudflare
placeholder не работает непосредственно для даты типа ввода.
вместо этого он показывает mm/dd/yyy
как показать дату?
используйте onfocus=»(this.type=’date’)» , например:
использовать onfocus и onblur. Вот он пример: