Languages
[Edit]
EN

HTML - time input

0 points
Created by:
Isaiah89
721

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 and max attributes or make the field required to fill.

<input type="time" name="appt" min="8:00" max="16:00" required />

References

Alternative titles

  1. HTML - input type time
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

HTML - input element types

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join