Programming Tip Of The Day #38: Difference between Datalist and Select Elements in HTML

3,976 views · Published 1 October 2018 · 7:20 · Indexed 20 November 2026

Channel: Thapa Technical · 2018 · Education

Watch on YouTube

Welcome, all we will see the HTML Datalist and Select Tag: Difference between Datalist and Select Elements in HTML in Hindi.
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 on your requirements. If the user must enter one of your choices, use the select element. If the user can enter whatever, use the datalist element.

Datalist includes autocomplete and suggestions natively, it can also allow a user to enter a value that is not defined in the suggestions.

Select only gives you pre-defined options the user has to select from

Data List is a new HTML tag in HTML5 supported browsers. It renders as a text box with some list of options. For Example for Gender Text box it will give you options as Male Female when you type 'M' or 'F' in Text Box.

To specifically answer a part of your question "Is there any situation in which it would be better to use one or the other?", consider a form with repeating sections. If the repeating section contains many select tags, then the options must be rendered for each select, for every row.

In such a case, I would consider using datalist with input, because the same datalist can be used for any number of inputs. This could potentially save a large amount of rendering time on the server, and would scale much better to any number of rows.

"Honestly, I have no idea how to ask, but if you donate using PAYTM to support me, It's gonna help me a lot."
PAYTM NUMBER: 9518369954 

Guys, Please support my channel by SUBSCRIBE to my channel and share my videos in your Social Network TimeLines.
Don't Forget to Follow  me on all Social Network, 
 
Instagram Link:     https://www.instagram.com/vinodthapa55
Facebook Link:     https://www.facebook.com/vinodthapa55
Twitter       Link:     https://twitter.com/vb55thapa
Facebook ThapaTechnical Page Link: https://www.facebook.com/vinodbahadurthapa
Youtube    Link:     https://www.youtube.com/channel/UCwfaAHy4zQUb2APNOGXUCCA

More from this channel