EN
HTML - time input
0
points
In this article, we would like to show you how to create time input element in HTML.
Quick solution:
// ONLINE-RUNNER:browser;
<input type="time" name="input-name" />
or:
// ONLINE-RUNNER:browser;
<input type="time" name="input-name" min="8:00" max="16:00" />
Practical example
In this example, we create a simple time input element on the HTML page using input
element's type="time"
attribute.
// ONLINE-RUNNER:browser;
<!doctype html>
<html>
<body>
<label>
<span>Select time:</span>
<input type="time" name="event-time" />
</label>
</body>
</html>
Note:
Additionally, you can specify the range of time input using
min
andmax
attributes or make the fieldrequired
to fill.<input type="time" name="appt" min="8:00" max="16:00" required />