I'm having a spot of bother with select boxes in IE7. I have one select 
box which empties and refills a second when the
selected item changes using an AJAX call. This works fine in Opera and 
FireFox but IE7 doesn't adjust the width of the
second select box to match the new contents. There must be a simple 
workaround for this but for the life of me I can't
find it. I don't really want to fix the size in CSS. My code is below, 
the AJAX page just returns a list of val=text pairs to
populate the select box.

Thanks for any assistance.

  $(document).ready(function(){
    $("#brandlist").focus().change(function(){
      $('#matches').empty();
      $.get("brand.map.helper.php",
            { code: $(this).val() },
            function(data) {
              var matches = data.split("\n");
              $("#sql").html(matches[0] + "<br>" + matches[1]);
              for (var i=2; i<matches.length-1; i++) {
                var params = matches[i].split("=");
                var o = new Option(params[1],params[0]);
                $("#matches").append(o);
              }
            });
        });
    });
  });

Reply via email to