Input Email type Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Email field

Description

The type property returns the type of form email element.

For an input type="email", this property always returns "email".

Return Value

A String, representing the type of form element the email field is

The following code shows how to return which type of form element the email field is:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

E-mail: <input type="email" id="myEmail">

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

<p id="demo"></p>

<script>
function myFunction() {//from   w w  w .  ja  va2s.  com
    var x = document.getElementById("myEmail").type;
    document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>

Related Tutorials