aurora
aurora

Reputation: 277

Select tag with 1000 options - performance hit

I am using a plugin called Chosen which basically adds searching to a select html object. I load the results from an ajax page. However I have a lot of options appended to the select tag - around a thousand. Maybe it is the chosen plugin, but having a 1000 options does seem a bit laggy.

How is this gonna affect performance and what are the workarounds?

Upvotes: 6

Views: 6596

Answers (1)

Klesun
Klesun

Reputation: 13739

Instead of <select> you could use <input> + <datalist>, that handles 1000+ options pretty well.

jsfiddle

<input type="text" list="your-data-list"/>
<datalist id="your-data-list">
    <option value="1">Option 1</option>
    <option value="2">Option 2</option>
    ...
    <option value="9999">Option 9999</option>
</datalist>

Upvotes: 11

Related Questions