Get Input Email field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Email field

Introduction

The Input Email object represents an HTML <input> element with type="email".

You can access an <input> element with type="email" by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

E-mail: <input type="email" id="myEmail" value="john@example.com">

<button onclick="myFunction()">get the e-mail address of the email field</button>

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

<script>
function myFunction() {/*  ww  w. j a v  a 2 s.  c  om*/
    var x = document.getElementById("myEmail").value;
    document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>

Related Tutorials