X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

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

Internet Explorer Firefox Opera Google Chrome Safari

The value property is supported in all major browsers.

Note: The <input type="url"> element is not supported in Internet Explorer 9 and earlier versions, or in Safari.


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 »


Related Pages

HTML reference: HTML <input> value attribute


Input URL Object Reference Input URL Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook