Use url input to collect url input from user

Description

The url type values configure the input element to accept only input that is a URL.

It supports the additional attributes shown in the following list.

  • list - Sets the id of a datalist element that provides values for the element.
  • maxlength - Specifies the maximum length that the user can enter into the text box.
  • pattern - Specifies a regular expression pattern for input validation.
  • placeholder - Specifies a hint to the user.
  • readonly - If present, make the text box read-only.
  • required - Specifies that the user must provide a value.
  • size - Specifies the width of the element.
  • value - Specifies the initial value for the element.

Example


<!DOCTYPE HTML>
<html>
<body>
  <form method="post" action="http://example.com/form">
<!--  ww w .  java 2  s.co  m-->
    <p>
      <label for="url"> Your homepage: <input type="url" id="url"
        name="url" />
      </label>
    </p>
    <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