HTML 输入类型日期,默认打开日历
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24975667/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTML Input Type Date, Open Calendar by default
提问by user2291845
I have a task which is to show the calendar by default to select date in the input field of html.
我有一个任务是默认显示日历以在 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.
告诉我如何在不点击输入的情况下默认显示日历。
采纳答案by alexander farkas
This is not possible with native HTML input elements. You can use webshim polyfill, which gives you this option by using this markup.
这对于原生 HTML 输入元素是不可能的。您可以使用webshim polyfill,它通过使用此标记为您提供此选项。
<input type="date" data-date-inline-picker="true" />
Here is a small demo
这是一个小演示