I need to ask the user for a duration in a html input.
f.e. 03h 12m 12s
Is there any way to give him a selection, like input type date?
I use Bootstrap 4.
Thank you
I need to ask the user for a duration in a html input.
f.e. 03h 12m 12s
Is there any way to give him a selection, like input type date?
I use Bootstrap 4.
Thank you
<input type='number'>
set min
and max
input,
label {
font: inherit;
width: 4ch;
}
<form id='duration'>
<input id='h' name='h' type='number' min='0' max='23'>
<label for='h'>h</label>
<input id='m' name='m' type='number' min='0' max='59'>
<label for='m'>m</label>
<input id='s' name='s' type='number' min='0' max='59'>
<label for='s'>s</label>
</form>
This post is 5 years old, but your problem still does not have an answer. (Here on SO or in HTML)!
Don't know why it's taking HTML standards so long to adopt a time as a 'base' unit input control. So much effort has been spent on variations in clock type and world calendars that a simple countdown timer is hard to code!
I've just released a webcomponent input-duration to fix the situation: NPM input-duration, written in vanilla JS and works with or without JS bundling.
<input-duration id="bob"></input-duration><br>
<script type="module">
import id from 'https://cdn.jsdelivr.net/npm/input-duration/+esm'
</script>
© 2022 - 2024 — McMap. All rights reserved.