Does anyone know how many options a drop down list can have? Is it unlimited? How many before performance degrades?
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
-
Why does the box-shadow property not apply to a
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.
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:
Javascript
Regards,
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
I've used right around 500 in a list with no noticeable performance impact if that helps!
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.
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.
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.