Example of a dynamic HTML5 datalist control · Raymond Camden
I've made no secret of being a huge fan of the updates to forms within HTML5. One of the more interesting updates is the datalist control. This control gives you basic autocomplete support for an input field. At its simplest, you create the datalist control options, tie it to a control, and when the user types, they see items that match your initial list. Consider this example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Example 0</title> | |
</head> | |
<body> | |
<p> | |
<input type="text" name="search" id="search" placeholder="Type Something" list="searchresults" autocomplete="off"> | |
<datalist id="searchresults"> | |
<option>Ray</option> | |
<option>Scott</option> | |
<option>Todd</option> | |
<option>Dave</option> | |
<option>Jeanne</option> | |
<option>Jacob</option> | |
</datalist> | |
</p> | |
</body> | |
</html> |
Read full article from Example of a dynamic HTML5 datalist control · Raymond Camden
No comments:
Post a Comment