是否有从 html5 元素 type="datetime-local"启动日历/时间 View ?
<input type="datetime-local" id="dtl" />
<script>
$('#dtl').click();
</script>
不起作用,即使您可以监听点击事件。
最佳答案
不幸的是,并非如此。
HTML5 日历 View 由每个浏览器以不同方式实现,因此没有可靠的方法来激活浏览器的日期时间日历选择器。你能做的最好的可能是 $('#dtl').focus();
专注于该领域,但我知道这不是你想要的。
跨浏览器的替代方法是使用类似 jQuery UI datepicker 的东西.
关于html - 以编程方式启动 html5 datetime-local,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20022726/