The input email list property in HTML DOM is used to return a reference to the datalist element that contains an input email field.
Syntax:
emailObject.list.id
Return Value: It returns a string value that represents the value of the id attribute of the datalist element.
Example: Below is the HTML code used to return the input email list property.
HTML
<!DOCTYPE html> < html >
< head >
< title > HTML DOM Input Email list Property</ title >
</ head >
< body style = "text-align:center;" >
< h1 style = "color:green" >
GeeksforGeeks
</ h1 >
< h2 >DOM Input Email list property</ h2 >
E-mail: < input type = "email" id = "email"
list = "email_list" name = "myGeeks"
value = "careers@geeksforgeeks.org" >
< datalist id = "email_list" >
< option value = "GFG@gmail.com" />
< option value = "manas@gmail.com" />
< option value = "akku@gmail.com" />
< option value = "akash@gmail.com" />
< option value = "amar@gmail.com" />
</ datalist >< br >
< br >< br >
< button onclick = "btnclick()" >
Click Here!
</ button >
< p id = "paraID" style = "font-size:20px;color:green;" ></ p >
<!-- Script to return Input Email list Property -->
< script >
function btnclick() {
var em = document.getElementById("email").list.id;
document.getElementById("paraID").innerHTML = em;
}
</ script >
</ body >
</ html >
|
Output:
Supported Browsers:
- Google Chrome 5
- Edge 12
- Mozilla Firefox
- Opera 11
- Safari