Question

Does anyone know how many options a drop down list can have? Is it unlimited? How many before performance degrades?

Was it helpful?

Solution

Does anyone know how many options a drop down list can have? Is it unlimited?

I imagine it is unlimited in theory, obviously not in practice as a computer's RAM and the specific browser's limitations come into play.

How many before performance degrades?

Again, this would depend on a few factors, at the least the specific browser, the computer's memory and processing power.


EDIT: From experience, I have had drop down lists with thousands of options. It wasn't ideal though because who wants to scroll through all of those? This is why an auto-complete of some type is more desirable for numerous reasons, especially the end user's experience.

OTHER TIPS

Update: Based on DannyG, tested on Ubuntu with Firefox on a 4GB mem pc, limit was far beyond 10k tags. My current Firefox is set to use up to 3GB and it has reached a 100k options, but for that, you'd have to change the default config of the browser I guess.

We opted to use an Ajax autocomplete as replacement in all cases that 30+ options where given.

Both Firefox and Chrome limited to 10k options in Windows 64b with 4GB ram on default config.

Tested with JSFiddle http://jsfiddle.net/Mare6/

Html:

<a>Testing Select</a>
<select id="list"></select>

Javascript

window.onLoad = function() {
    for (var i=0; i<10000; i++) {
        var name = "Option "+i;
        var sel = document.getElementById("list");
        sel.options[sel.options.length] = new Option(name,i);
    }
});

Regards,

I've used right around 500 in a list with no noticeable performance impact if that helps!

In my experience the performance degradation is generally on the side of the user, my golden rule (learned somewhere) is seven options, give or take a few.

On a more SW related basis, probably the top range of Integer.

EDIT: BTW This is kind of relevant from Atwood

Yes, the maximum for Chrome and Safari is 10000 items for select elements at least.

The relevant lines in the Chrome source can be found here: Defined max of 10000, Code that enforces limit and puts error in console

Firefox seems to have no practical limit from my testing.

In theory, there is no limit, but some browsers will implement limits. (Similar to using document.write in an infinite loop.)

But, at the end of the day, the most I would ever recommend in a drop-down-list, is about 50, just because no-one wants to do that much scrolling. That said, if organized, say by alphabetical order, it may be appropriate to have as many as 200 items in a drop-down-list. (Like for a sign-up form where you must select you country of birth.)

Also, when you have many different set choices, a drop-down-list is normally the best option, regardless.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top