Search w3schools.com:

SHARE THIS PAGE

Password select() Method

Password Object Reference Password Object

Definition and Usage

The select() method is used to select the content of a password field.

Syntax

passwordObject.select()


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The select() method is supported in all major browsers.


Example

Example

Select the content of a password field:

<html>
<head>
<script>
function myFunction()
{
document.getElementById("pwd").select();
}
</script>
</head>
<body>

<form>
Password: <input type="password" id="pwd" value="thgrt456">
</form>

<button type="button" onclick="myFunction()">Select content</button>

</body>
</html>

Try it yourself »


Password Object Reference Password Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]