强制A引领零在页面上显示输入类型=“文本”时间格式HH:MM:SS

发布于 2025-01-30 00:09:18 字数 202 浏览 3 评论 0原文

html markup < input type =“ text” value =“ 00:00:00” class =“ datepicker time” aria-invalid =“ false”>不会在一个中显示领先零带有时间格式的文本输入HH:MM:SS。即使输入的值为00:00:00,页面也显示为0:00:00。我如何强迫领先的零显示?

HTML markup <input type="text" value="00:00:00" class="datepicker-time" aria-invalid="false"> does not display the leading zero in a text input with time format hh:mm:ss. Even though the value for the input is 00:00:00, the page shows 0:00:00. How can I force the leading zero to display?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海里的那抹蓝 2025-02-06 00:09:18

如@paulie_d所说 - 使用type ='time'而不是文本..

&lt; input type =“ time” value =“ 00:00” class =“ datepicker time” aria-无效=“ false”/&gt;

要注意的一件事是, developer.mozilla.org js和常规 html 项目中都有很多有关如何使用此方法的好信息。

As @Paulie_D said - use type='time' instead of text..

<input type="time" value="00:00" class="datepicker-time" aria-invalid="false"/>

One thing to note is that developer.mozilla.org has a lot of good info on how you can use this, both in JS and the general HTML items.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文