Input URL value attribute
Definition and Usage
value
Sets or returns the value of the value attribute 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 attributes:
var x = document.getElementById("myURL"); var defaultVal = x.defaultValue; var currentVal = x.value;
Syntax
Return the value attribute:
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: | A string value representing a URL. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Supported | 10.0 | Supported | Not Supported | Supported |