Think of it as the difference between a requirement and a suggestion. For the select
element, the user is required to select one of the options you've given. For the datalist
element, it is suggested that the user select one of the options you've given, but he can actually enter anything he wants in the input.
Edit 1: So which one you use depends upon your requirements. If the user must enter one of your choices, use the select
element. If the use can enter whatever, use the datalist
element.
Edit 2: Found this tidbit in the HTML Living Standard: "Each option element that is a descendant of the datalist element...represents a suggestion."
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…