Easy Tutorial
❮ Prop Doc Url Prop Canvas Textalign ❯

Password select() Method


Definition and Usage

The select() method is used to select the text in a password field.

Syntax


Browser Support

All major browsers support the select() method.


Example

The following example selects the text in a password field:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<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 Text</button>

</body>
</html>

❮ Prop Doc Url Prop Canvas Textalign ❯