This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis
Not too long ago, we finally got cross-browser-supported date input elements. With Safari joining the party, we're now all green on the browser support front to show native date pickers everywhere.
There was still one piece missing, though. If now all major browsers support native date pickers, developers asked for a method to programmatically open it.
Say hello to elem.showPicker()
!
const button = document.querySelector("button");
const dateInput = document.querySelector("input");
button.addEventListener("click", async () => {
try {
await dateInput.showPicker();
// A date picker is shown.
} catch (error) {
// Use external library when this fails.
}
});
The new method will be available in Chromium 99+.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
99 | 99 | 99 | Nei | Nö | Nö | Nope | Nein | 99 |
Webkit and Firefox also showed interest in implementing it:
I just love it when we get new DOM methods!
Reply to Stefan
This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis

Stefan Judis | Sciencx (2022-01-09T18:45:00+00:00) New on the web: programmatically open a native date picker (#blogPost). Retrieved from https://www.scien.cx/2022/01/09/new-on-the-web-programmatically-open-a-native-date-picker-blogpost/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.