Dofactory.com
Dofactory.com

HTML <input> type="url"

The <input> tag with a type="url" attribute creates an input field for URL values.

This field only accepts valid URLs.

Example

#

An <input> element of type url.
Only valid url values are accepted.

Your website

<form action="/tutorial/action.html">
  <fieldset>
    <legend>Your website</legend>

    <input type="url" name="url" style="width:350px"
           placeholder="Enter URL..."><br /><br />

    <input type="submit" value="Submit">
  </fieldset>
</form>

Using input type="url"

The <input type="url"> creates a field that accepts a URL value.

This input field is validated when submitted. It only accepts null or a valid URL.


Syntax

<input type="url">

Browser support

Here is when type="url" support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
10.0 Sep 2012
Opera
10.1 Jun 2009
Safari
1.0 Jan 2003

You may also like

 Back to <input>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023


What's your favorite/least favorite part of Dofactory?


Guides