HTML DOM Input URL Object

Input URL object

The Input URL object is a new object in HTML5.

The Input URL object represents the HTML <input type="url"> element.

Note:Internet Explorer 9 (and earlier versions) or Safari does not support the <input type="search"> element.

Access Input URL object

You can access the <input type="url"> element by using getElementById():

var x = document.getElementById("myUrl");

Try it yourself

Create Input URL object

You can create an <input type="url"> element by using the document.createElement() method:

var x = document.createElement("INPUT");
x.setAttribute("type", "url");

Try it yourself

Input URL object attribute

Properties Description
autocomplete Set or return the autocomplete attribute value of the Search field.
autofocus Set or return whether the Search field should automatically gain focus after the page is loaded.
defaultValue Set or return the default value of the Search field.
disabled Set or return whether the Search field is disabled.
form Return a reference to the form containing the Search field.
list Return a reference to the datalist containing the Search field.
maxLength Set or return the maxLength attribute value of the search field.
multiple Set or return whether the user is allowed to input more than one URL address in the URL field.
name Set or return the name attribute value of the Search field.
pattern Set or return the pattern attribute value of the Search field.
placeholder Set or return the placeholder attribute value of the Search field.
readOnly Set or return whether the Search field is read-only.
required Set or return whether the Search field must be filled out before submitting the form.
size Set or return the size attribute value of the Search field.
step Set or return the step attribute value of the Search field.
type Return the form element type of the Search field.
value Set or return the value attribute of the Search field.

Input URL object methods

Method Description
blur() Remove focus from the URL field.
focus() Set focus to the URL field.
select() Select the content of the URL text field.

Standard properties and events

The Input URL object supports standardsPropertiesAndEvents.

Related Pages

HTML Tutorial:HTML Forms

HTML Reference Manual:HTML <input> tag

HTML Reference Manual:HTML <input> type attribute