HTML DOM Input URL Object
Input URL Object
The Input URL object is new in HTML5.
The Input URL object represents an HTML <input> element with type="url".
Note:Internet Explorer 9 (and earlier IE versions), or Safari browser, do not support the HTML <input> element with type="url".
Access an Input URL Object
You can use the getElementById() function to access an <input> element with type="url":
var x = document.getElementById("myUrl");
Try it Yourself
Tip:You can also use the form'selementscollection to access the Input URL object.
Create an Input URL Object
You can use the document.createElement() method to create an <input> element with type="url":
var x = document.createElement("INPUT");
x.setAttribute("type", "url"); Try it Yourself
x.setAttribute("type", "url"); Try it Yourself
Input URL Object Properties
| Property | Description |
|---|---|
| autocomplete | Sets or returns the value of the autocomplete attribute of the URL field |
| autofocus | Sets or returns whether the URL field automatically gets focus after the page loads |
| defaultValue | Sets or returns the default value of the URL field |
| disabled | Sets or returns whether the URL field is enabled |
| form | Returns a reference to the form that contains the URL field |
| list | Returns a reference to the datalist that contains the URL field |
| maxLength | Sets or returns the value of the maxlength attribute of the URL field |
| multiple | Sets or returns whether the URL field allows users to enter one or more URL addresses. |
| name | Sets or returns the value of the name attribute of the URL field |
| pattern | Sets or returns the value of the pattern attribute of the URL field |
| placeholder | Sets or returns the value of the placeholder attribute of the URL field |
| readOnly | Sets or returns whether the URL field is read-only |
| required | Sets or returns whether the URL field is a required field in the form |
| size | Sets or returns the value of the size attribute of the URL field |
| step | Sets or returns the value of the step attribute of the URL field |
| type | Returns the type of form element of the URL field |
| value | Sets or returns the value of the value attribute of the URL field |
Standard Properties and Events
The Input URL object also supports standardpropertiesandevents。
Related Articles
HTML Tutorial:HTML Forms
HTML Reference Manual:HTML <input> Tag
HTML Reference Manual:HTML <input> type Attribute
Other Extensions