Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input URL value Property

Input URL value property

Input URL Object Reference The Input URL object

Example

Modify the value of the URL field:

document.getElementById("myURL").value = "http://www.google.com";

Try it »


Definition and Usage

The value property is used to set or return the value of the URL field's value attribute.

The value attribute describes the value entered by the user, the default value, or the value entered by a script.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value attribute

Note: Internet Explorer or Safari browsers do not support HTML that uses the type="url" attribute. .


Syntax

Return the value attribute:

urlObject

.value

Set the value attribute:

urlObject

.value=

URL

Attribute values

Value Description
URL Describes an absolute URL address (e.g.: "http://www.w3cschool.cc")

Technical Details

Return Value: A string representing the value of the URL field

More examples

Example

Get the value of the URL field:

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

x

The output is:

http://www.runoob.com

Try it »


Related pages

HTML Reference Manual: HTML value attribute


Input URL Object Reference The Input URL object