Input URL name property
Example
Get the name of the URL field:
var x = document.getElementById("myURL").name;
x
The output is:
website
Try it »
Definition and Usage
The name property is used to set or return the value of the URL field's name attribute.
The name attribute is typically used as the identifier for submitting form data to the server, or as a reference identifier for JavaScript on the client side.
Note: Data can only be submitted to the server after the form is submitted if the name attribute is set.
Browser support





All major browsers support the name attribute.
Note: Internet Explorer or Safari browsers do not support HTML that uses the type="url" attribute. .
Syntax
Return the name attribute:
urlObject
.name
Set the name attribute:
urlObject
.name=
name
Attribute values
| Value | Description |
|---|---|
| name | Describes the name of the URL field |
Technical Details
| Return Value: | A string representing the name of the URL field |
|---|
More examples
Example
Modify the name of the URL field:
document.getElementById("myURL").name = "newNameValue";
Try it »
Related pages
HTML Reference Manual: HTML name attribute
The Input URL object