Using the input Element to Obtain a Number in a Given Range

Description

We can get a numeric value using the range type of input element.

The value from range input element restricts the user to selecting a value from a predetermined range.

The range type supports the same set of attributes as the number type,

Example

The following code shows the range type in use.


<!DOCTYPE HTML>
<html>
<body>
  <form method="post" action="http://example.com/form">
    <p>
      <label for="price"> $ per unit in your area: 1 <input
        type="range" step="1" min="0" max="100" value="1" id="price"
        name="price" />100
      </label>
    </p><!--  w  w  w.  ja  v a2s  .c  o m-->
    <input type="submit" value="Submit Vote" />
  </form>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed