A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Option: datalist vs select

richarddunnebsc
2021-09-01

I just started working with datalist in conjunction with inputs. When creating an option in a datalist, (I’m using Visual Studio Code) the IDE displays an opening and closing option tag. However, according to W3schools, there is no closing option tag in a datalist. This seems inconsistent, or maybe it doesn’t matter either way.

simevidas
2021-09-05

This is defined in the HTML Standard:

An option element’s end tag can be omitted if the option element is immediately followed by another option element, or if it is immediately followed by an optgroup element, or if there is no more content in the parent element.