Javascript Reference - HTML DOM Input Email type Property








The type property returns the type of the email field.

Browser Support

type Yes 10.0 Yes Yes Yes

Syntax

var v = emailObject.type

Return Value

A String type value representing the type of the email field.





Example

The following code shows how to get the type of the email field.


<!DOCTYPE html>
<html>
<body>
<!--  w  ww  .j  a  v a 2  s.c  om-->
E-mail: <input type="email" id="myEmail">
<button onclick="myFunction()">test</button>
<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myEmail").type;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: