views:

268

answers:

2

There seem to be a limitation in the maximum number of clickable options in a select element.

If there is a select element with 3200+ options. Items from 3125 to N doesn't fire change event when they are clicked. However, items can be selected with the keyboard.

Any idea if this is a bug or a feature of IE8?. There is no such problem in IE6, IE7, FF or chrome.

Here is an example:

<html>
  <head>
    <title>Large select</title>
  <script>
  function loadData()
  {
    var s=document.getElementById('s');
    for(i=0;i<3500;i++)
      s.options[i]=new Option(i);
  }
  </script>
</head>
<body onload="loadData()">
<select id="s" multiple="multiple" size="20" onchange="alert('change')"></select>
</body>
</html>

update: I was trying this in ie8 beta (8.0.7000.0). It seems to work perfectly in ie8 final

+4  A: 

There is no such problem in ...

Problem?! Am I the only SO user scared of the beast you're creating?

Just out of curiosity, why on earth do you have so many options?

Edit: Don't get me wrong, it's fun to learn the upper limits of things. But now I've seen this now works in IE8 final, my next website is going to have at least 6000 <options> in any <select> I use!

Rock on!

Oli
no, you're not alone. /me cringes
Jonathan Fingland
+2  A: 

It's yet another of those limitations that you should NEVER hit. Just like the maximum number of columns in a database table. Even asking what the limit is indicates a terrible flaw in the design.

erikkallen