Articles → HTML 5 → Datalist In Html5
Datalist In Html5
Purpose
Syntax
<input list="list_id" name="textbox_name">
<datalist id="list_id">
<option value="option 1">
<option value="option 2">
<option value="option 3"> .. </datalist>
Example
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body> State
<input list="list_of_states" name="state">
<datalist id="list_of_states">
<option value="Andhra Pradesh">
<option value="Assam">
<option value="Bihar">
<option value="Chandigarh">
<option value="Chhattisgarh">
<option value="Delhi">
<option value="Goa">
<option value="Gujarat">
<option value="Haryana">
<option value="Himachal Pradesh">
<option value="Jammu and Kashmir">
<option value="Jharkhand">
<option value="Karnataka">
<option value="Kerala">
<option value="Madhya Pradesh">
<option value="Maharashtra">
<option value="Odisha">
<option value="Punjab">
<option value="Rajasthan">
<option value="Tamil Nadu">
<option value="Telangana">
<option value="Tripura">
<option value="Uttar Pradesh">
<option value="Uttarakhand">
<option value="West Bengal">
</datalist>
</body>
</html>
Try It
Output
Browser Support
Internet Explorer | Firefox | Chrome | Safari | Opera | Edge |
---|
10.0 | 4.0 | 20.0 | Not Supported | 9.0 | Yes |
Video