我正在写一个闹钟网络应用程序。我有两个号码输入,一个是小时,一个是分钟。因此,当我使用我的键盘箭头时,它们从0到23/59。有没有一种HTML原生的方式,使他们从00(01,02等)到23/59而不是?
我只关心UI方面因为我的JS管理丢失的0。
编辑 - 根据要求:
我有:
p>
我想要的:
从0,1,2到59,我想在数字小于10(00,01,
解决方案恐怕除非使用Select标签,否则没有原生的HTML方法。如果您使用的是文本输入,则必须通过javascript在10个第一个值上添加前导0。
I'm writing an alarm web app. I have two number inputs, one for the hours, one for the minutes. Thus, when I use my keyboard arrows, they go from 0 to 23/59. Is there an HTML native way to make them go from 00 (01,02, et.) to 23/59 instead ?
I'm only worried about the UI aspects as my JS manages the missing 0 anyway.
EDIT - As requested :
What I have :
What I want :
Instead of going from 0,1,2 to 59, I'd like to automatically have a leading 0 when the number is smaller than 10 (00,01,02 to 59).
解决方案I'm afraid there is not native HTML way to do that unless using a Select tag. If you are using a text input you have to add the leading 0 on the 10 first values by javascript.
更多推荐
在数字输入中强制引导零
发布评论