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

Password value Property

Password Object Reference Password Object

Example

Return the value of the value attribute of a password field:

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

Try it yourself »

Definition and Usage

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

The value property contains 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.


Syntax

Return the value property:

passwordObject.value

Set the value property:

passwordObject.value=text

Property Values

Value Description
text Specifies the initial (default) value of the password field

Technical Details

Return Value: A String, representing the value of the value attribute of the password field


More Examples

Example

Change the value of the password field:

document.getElementById("myPsw").value = "NewPassword123";

Try it yourself »


Related Pages

HTML reference: HTML <input> value attribute


Password Object Reference Password Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE