<!DOCTYPE html>
<html>
<body>
<form>
<input list="browsers" name="browser">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option id="google" value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
</form>
<p>Click the button to display the value of the option in the datalist with id="google".</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("browsers").options.namedItem("google").value;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>