Easy Tutorial
❮ Met Document Removeeventlistener Event Onended ❯

Password type Attribute


Definition and Usage

The type attribute returns the type of the form element.

For password fields, this attribute is always "password".

Syntax


Browser Support

All major browsers support the type attribute.


Example

The following example returns the type of the form element for the password field:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<script>
function displayResult(){
    var x=document.getElementById("pwd").type;
    alert(x);
}
</script>
</head>
<body>

<form>
Password: <input type="password" id="pwd">
</form>
<button type="button" onclick="displayResult()">Display input type</button>

</body>
</html>

❮ Met Document Removeeventlistener Event Onended ❯