How do we include the legal number intervals for an input field in HTML?

HTMLWeb DevelopmentFront End Technology

Use the step attribute to include the legal number intervals for an input field in HTML. The HTML input type step attribute sets the legal number intervals. Steps are number steps like 0, 5, 10, 15, 20, etc. The step attribute can be used together with the max and min attributes to create a range of legal values.

Example

You can try to run the following code to implement step attribute −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML input step attribute</title>
   </head>
   <body>
      <form action = "" method = "get">
         <input type = "number" name = "points" step = "5"><br>
         <input type = "submit" value = "Submit">
      </form>
   </body>
</html>
raja
Published on 14-Mar-2018 11:11:09
Advertisements