Input Password select() Method - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Password

Description

The select() method selects the content of a password field.

Parameters

None.

Return Value

No return value.

The following code shows how to Select the content of a password field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Password: <input type="password" id="myPsw" value="thgrt456">

<button type="button" onclick="myFunction()">Test</button>

<script>
function myFunction() {//  www. ja  va 2 s.  com
    document.getElementById("myPsw").select();
}
</script>

</body>
</html>

Related Tutorials