Sumari
L'Element HTML Datalist (<datalist>) conté un conjunt d'elements <option>
que representen els valors disponibles per a altres controls.
Categories de contingut | Contingut dinàmic, phrasing content. |
---|---|
Contingut permès | Qualsevol phrasing content o zero o més elements <option> . |
Omissió de l'etiqueta | Cap, tant l'etiqueta inicial com l’etiqueta final són obligatòries |
Elements pares permesos | Qualsevol element que accepti phrasing content. |
Interfície DOM | HTMLDataListElement |
Atributs
Aquest element no té altres atributs que els atributs globals, comuns a tots els elements.
Exemples
<label>Choose a browser from this list: <input list="browsers" name="myBrowser" /></label> <datalist id="browsers"> <option value="Chrome"> <option value="Firefox"> <option value="Internet Explorer"> <option value="Opera"> <option value="Safari"> <option value="Microsoft Edge"> </datalist>
Resultat
- Utilitzant el resultat
L'atribut name de l'element <input> especifica el nom del control, que es presenta amb les dades del formulari.
Aquest formulari de dades passa a estar disponible al servidor de la petició http: String myBrowser = request.getParameter("myBrowser");
Especificacions
Especificació | Estat | Comentari |
---|---|---|
HTML Living Standard The definition of '<datalist>' in that specification. |
Living Standard | |
HTML5 The definition of '<datalist>' in that specification. |
Recommendation |
Polyfill
Navegadors compatibles
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Suport bàsic | 20 | 4.0 (2.0) | 10 | 9.5 | No support |
Característica | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Suport bàsic | 33 | 4.0 (2.0) | No support | 10 | No support |