Anchor password attribute

Definition and usage

password Attribute setting or return href attribute value password part.

In the URL, the password part is the password entered by the user. It is specified between the username and the hostname.

For example: https://billgates:bill234@www.example.com (billgates is the username, bill234 is the password).

Tip:Please use username attribute Set or return href attribute value user name part.

Example

Example 1

Return the password part of the link:

var x = document.getElementById("myAnchor").password;

Try it yourself

Example 2

Change the password part of the link:

document.getElementById("myAnchor").password = "newPassword101";

Try it yourself

Syntax

Return the password attribute:

anchorObject.password

Set the password attribute:

anchorObject.password = password

Attribute Value

Value Description
password Specifies the password part of the URL.

Technical Details

Return Value: A string value representing the password part of the URL.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Supported Not Supported Supported Not Supported Supported