HTML Input Type Date, Open Calendar by default

2019-02-06 00:33发布

问题:

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.

回答1:

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