Input URL value attribute
Definition and Usage
value
Sets or returns the value of the value property of the URL field.
The HTML value attribute specifies the default value or the value entered by the user (or the value set by the script).
See also:
HTML Reference Manual:HTML <input> value attribute
Example
Example 1
Change the URL field's URL:
document.getElementById("myURL").value = "http://www.ifeng.com";
Example 2
Get the URL field's URL:
var x = document.getElementById("myURL").value;
Example 3
Example showing the difference between the defaultValue and value properties:
var x = document.getElementById("myURL"); var defaultVal = x.defaultValue; var currentVal = x.value;
Syntax
Return the value property:
urlObject.value
Set value attribute:
urlObject.value = URL
Attribute value
Value | Description |
---|---|
URL | Specifies an absolute URL (a URL pointing to another website, for example "http://www.google.com"). |
Technical details
Return value: | String value, representing a URL. |
---|
Browser support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Supported | 10.0 | Supported | Not supported | Supported |