Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML DOM Input URL object


May 06, 2021 JavaScript with HTML DOM Reference book


Table of contents


HTML DOM Input URL object


The Input URL object

The Input URL object is new to HTML5.

The Input URL object represents an HTML-lt;input> element that uses the type-"url" property.

Note: Internet Explorer 9 (and earlier versions of IE), or Safari does not support HTML elements that use the type"url" property.

Access the Input URL object

You can use the getElementById() function to access the elements that use the type"url" property:

var x = document.getElementById("myUrl"); Give it a try

Tip: You can also access the Input URL object through the form's collection of elements.

Create an Input URL object

You can use the document.createElement() method to create an element that uses the type-"url" property:

var x = document.createElement("INPUT");
x.setAttribute("type", "url"); Give it a try

Input URL object properties

Property Describe
autocomplete Set or return the autocomplete property value of the URL field
autofocus Set or return whether the URL field automatically gets focus after the page loads
defaultValue Set or return the default value for the URL field
disabled Set or return whether the URL field is available
form Returns a form reference that uses the URL field
list Returns a datalist reference that contains the URL field
maxLength Set or return the maxlength property value of the URL field
multiple Set or return whether the URL field allows users to enter one or more url addresses.
name Set or return the name property value of the URL field
pattern Set or return the value of the URL field pattern property
placeholder Set or return the value of the URL field placeholder property
readOnly Set or return whether the URL field is read-only
required Set or return whether the URL field is required in the form
size Set or return the value of the URL segment size property
step Set or return the value of the URL segment step property
type The type of form element that returns the URL field
value Set or return the value property value of the URL field

Standard properties and events

Input URL objects also support standard properties and events.


Related articles

HTML tutorial: HTML forms

HTML Reference Manual: HTML slt;input.gt; Tags

HTML Reference Manual: HTML slt;input> type property