THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML

Input URL value Property

Input URL Object Reference Input URL Object

Example

Change the URL of a URL field:

document.getElementById("myURL").value = "http://www.cnn.com";
Try it Yourself »

Definition and Usage

The value property sets or returns the value of the value attribute of a URL field.

The value attribute specifies the default value OR the value a user types in (or a value set by a script).


Browser Support

Property
value Yes 10.0 Yes Not supported Yes

Syntax

Return the value property:

urlObject.value

Set the value property:

urlObject.value=URL

Property Values

Value Description
URL Specifies an absolute URL (an URL that points to another website, like "http://www.google.com")

Technical Details

Return Value: A String, representing a URL

More Examples

Example

Get the URL of a URL field:

var x = document.getElementById("myURL").value;

The result of x will be:

http://www.google.com
Try it Yourself »

Example

An example that shows the difference between the defaultValue and value property:

var x = document.getElementById("myURL");
var defaultVal = x.defaultValue;
var currentVal = x.value;
Try it Yourself »

Related Pages

HTML reference: HTML <input> value Attribute


Input URL Object Reference Input URL Object