HTML输入时间,step属性以设置(例如)x分钟的时间步长? [英] HTML input time, step attribute to set timestep by (say) x minutes?

查看:332
本文介绍了HTML输入时间,step属性以设置(例如)x分钟的时间步长?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有时间输入,基本上就是:

I have a time input, basically just:

Time: <input type="time" name="timeinput"/> 

http://jsfiddle.net/X8E9N/

根据 http://www.w3.org/TR/html-markup/input .time.html 它支持step属性.是否可以使用此属性(或其他方式)将步长设置为10分钟?如果可以,怎么办?

According to http://www.w3.org/TR/html-markup/input.time.html it supports the step attribute. Is it possible to use this attribute (or other means) to set the step size to 10 minutes? If so, how?

我知道其他一些解决方案(例如datebox插件),但我希望尽可能使用纯HTML解决方案.有时我使用datebox插件,但是在移动设备上它似乎很慢,因此我尝试在可能的情况下使用本机时间选择器.

I am aware of some other solutions (e.g. datebox plugin), but I'm hoping for a purely html solution if possible. I am using the datebox plugin sometimes, but it seems pretty slow on mobile devices so I am trying to use the native time pickers when possible.

推荐答案

是. 您可以在几秒钟内指定步骤属性.

但是,Opera,iOS Safari和Google Chrome浏览器不会拒绝用户输入不一致的信息.用户可以在该时间字段中指定11:59.然后,Opera和Google Chrome浏览器在尝试提交表单时会显示一条验证错误消息.

However, Opera, iOS Safari, and Google Chrome don't reject non-aligned user input. A user can specify 11:59 to such time field. Then, Opera and Google Chrome show a validation error message when he tries to submit the form.

这篇关于HTML输入时间,step属性以设置(例如)x分钟的时间步长?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆