Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Input Type Date, Open Calendar by default

Tags:

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.

like image 511
user2291845 Avatar asked Jul 26 '14 21:07

user2291845


People also ask

What is the input type for date in HTML?

The <input type="date"> defines a date picker. The resulting value includes the year, month, and day.

How do I open HTML date picker dialog on click anywhere inside input?

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.

How do I change the default placeholder date in input type?

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.


1 Answers

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

like image 184
alexander farkas Avatar answered Sep 20 '22 17:09

alexander farkas