I have a task which is to show the calendar by default to select date in the input field of html.
For suppose this is the code:
input type="date" name="bday"
Ok, now when I click on the input box, the calendar appears.
Tell me how to show the calendar by default without clicking on the input.
The <input type="date"> defines a date picker. The resulting value includes the year, month, and day.
The default HTML input (code below) with type=date will display a date picker input. However the date picker dialog only opens when you click on the calendar icon at the far right of the input.
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.
This is not possible with native HTML input elements. You can use webshim polyfill, which gives you this option by using this markup.
<input type="date" data-date-inline-picker="true" />
Here is a small demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With