Help Center

Local Navigation

HTML element: <datalist>


BlackBerry® Device Software 5.0 or later

The <datalist> element provides a list of suggestions, each contained in a child <option> element, that can be used as the value of an associated <input> element. The <input> element references the <datalist> element when you specify by setting the list attribute as the value of the <datalist> element's id attribute.

The <datalist> element is used only with the input types that accept text, excluding the password input type. Valid input types include the text, email, search, url, and number types.

The list of options appears as a drop-down list when the user selects the associated text field control. The user can type text, or they can select one of the options from the list. When the user selects an option from the list, the BlackBerry® Browser sets the value attribute of the <input> element to the value of selected option.

In versions of the BlackBerry Device Software earlier than version 5.0, the BlackBerry® Browser ignores the <datalist> element, and does not display the list of options to the user.

Common attributes

The <datalist> element supports the class, dir, id, lang, style, and title attributes.

For more information, see Common attributes.

Code sample: Using the <datalist> element with an <input> element

	<label for="job_title">What is your current job title</label>
	<input type="text" name="job_title" list="jobs" required />
	<datalist id="jobs">
		<option value="Web developer" />
		<option value="Circus performer" />
		<option value="Professor of Icelandic literature" />


Was this information helpful? Send us your comments.