0

I needed to limit the number of options in a select dropdown, and I came across this answer, which showed a way - using javascript - do it.

But I started to wonder: Is there a way do also limit the number of options in a input list

If I wanted to only show three items (and a scroll bar) in this example:

<input list="browsers">

<datalist id="browsers">
  <option value="Internet Explorer">
  <option value="Firefox">
  <option value="Google Chrome">
  <option value="Opera">
  <option value="Safari">
</datalist>

Would be there a way to do it?

Thanks!

Raphael Aleixo
  • 597
  • 6
  • 18
  • 1
    https://stackoverflow.com/questions/43491711/how-to-give-scrolling-effect-in-datalist-dropdown https://stackoverflow.com/questions/45482404/how-to-make-a-html-datalist-overflow – j08691 Jul 08 '19 at 13:20
  • 1
    No, you can't style `datalist` as answered in [this](https://stackoverflow.com/questions/13693482/is-there-a-way-to-apply-a-css-style-on-html5-datalist-options) question. – Lucas Jul 08 '19 at 13:26
  • I did a terrible job searching for duplicates, apparently. :) – Raphael Aleixo Jul 08 '19 at 13:27
  • That's alright ;) – Lucas Jul 08 '19 at 13:28
  • Can I just praise you for introducing me to input list? That's so useful! – dev Jul 08 '19 at 15:50

0 Answers0