Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
379 views
in Technique[技术] by (71.8m points)

html - HTML5 "time" input interval

Maybe i am just not searching properly, but does anyone know of a way to have the time input only increment using the spinner based on a preset interval. So if it is 10 minutes, have the up arrow go +10 mins, if the hour changes it would automatically go + an hour

8:50 - Up arrow hit ends with 9:00 -OR- 8:50 - Down arrow hit ends with 8:40

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Sure, just use the step attribute, where the step specifies the number of seconds to increment (60 sec x 10 mins = 600 seconds):

<input type="time" value="08:30:00" step="600">

jsFiddle example


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...