HTML5 Zone is brought to you in partnership with:

Because I am constantly busy working on something, I have never had time to actually put everything in words and pictures. But, since you got here, then you must have already seen some part of my work - and this is the way I’m talking.I'm 23, born in Romania, student at UPG Romania in software development field. I started from 0, mostly with basic stuff, and I’m evolving every day to an expert. I'm focused on freelancing projects, from small websites, to really heavy stuff. I know that I look and act differently from most developers, but this is why you will love to work with me! Constantin has posted 42 posts at DZone. You can read more from them at their website. View Full User Profile

The New HTML5 Datalist Element

06.15.2012
| 3828 views |
  • submit to reddit
The HTML5 <datalist> element specifies a list of pre-defined options for an <input> element and it works like an “autocomplete” feature for users:
<!DOCTYPE html>
<html>
<body>

<form action="login.php" method="post">
User:
<input list="username" name="username" />
<datalist id="username">
  <option value="Aaron">
  <option value="Rafael">
  <option value="Cale">
  <option value="Eddie">
  <option value="Valentin">
</datalist>
Password:
<input type="password" />
<input type="submit" value="Login" />
</form>

</body>
</html>

And the output will be:
    The <datalist> tag is currently supported in Firefox and Opera. We can just hope that other browsers will soon support this great feature.
Published at DZone with permission of its author, Constantin Alin. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)