有没有替代方案,因为Firefox和Internet Explorer不支持它……
示例:
<form>
<input type="datetime-local">
</form>谢谢!
发布于 2014-10-22 04:17:04
您可以一起使用<input type="date"> <input type="time">。就我个人而言,我认为这就是为什么删除了datetime-local。还有一些很棒的polyfills,比如这个:http://afarkas.github.io/webshim/demos/index.html
发布于 2019-03-28 03:36:16
在我的例子中,我尝试了很多方法,但没有一件看起来是完美的,最后,我带着这段时间走来走去,将datetime拆分为两个内联输入,并删除它们之间的边界,使其看起来像一个输入变量:
<form action="" class="form-inline">
<div class="form-group">
<input class="form-control" style=" border-right-style: none" type="date" max="9999-12-12T00:00:00.00" />
</div>
<div class="form-group">
<input class="form-control" style=" border-left-style: none" type="time" max="9999-12-12T00:00:00.00" />
</div>
发布于 2020-02-28 02:41:31
我在寻找替代datetime-local的东西时遇到了这个问题
https://www.daterangepicker.com/
它有类似于datetime-local的功能,还有一些额外的功能。您必须考虑的一件事是,如果您以这种方式更改输入框中的日期值,则可以限制用户更改日期值。datetime-local会自动阻止将字母放入时间值中。
否则,Jonathan的答案似乎仍然是与FF/Chrome一起工作的最佳基本内置选项。
https://stackoverflow.com/questions/26495326
复制相似问题