Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
HTML DOM Input Email name Property
The HTML DOM Input Email name property returns a, which is the value of the name attribute of input Email. User can also set it to a new string.
Syntax
Following is the syntax −
- Returning string value
inputEmailObject.name
- Setting name attribute to a string value
inputEmailObject.name = ‘String’
Example
Let us see an example of Input Email name property −
<!DOCTYPE html>
<html>
<head>
<title>Input Email name</title>
<style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
</style>
</head>
<body>
<form>
<fieldset>
<legend>Email-name</legend>
<label for="EmailSelect">Employee Email:
<input type="email" id="EmailSelect" value="x.agent@secret.com" name="Shasha-Miller">
</label>
<input type="button" onclick="getName()" value="Who's Email ID is this? ">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var inputEmail = document.getElementById("EmailSelect");
function getName() {
if(inputEmail.value === 'x.agent@secret.com')
divDisplay.textContent = 'Above Email belongs to '+inputEmail.name;
else
divDisplay.textContent = 'Above Email belongs to no one!';
}
</script>
</body>
</html>
Output
This will produce the following output −
Before clicking ‘Who’s Email ID is this?’ button −

After clicking ‘Who’s Email ID is this?’ button −

Advertisements
