Bug Tracker

Modify

Ticket #10116 (closed bug: invalid)

Opened 22 months ago

Last modified 22 months ago

Get the selected value of matched select in IE6

Reported by: sparebox84@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.6.2
Keywords: Cc:
Blocking: Blocked by:

Description

I didn't find any bugs matching this.

Immediately after populating my drop down via

for (var i = 0; i < options.length; i++) {
   $("#" + mStateDDToUpdate).append("<option value='" + options[i].Key.trim() + "' >" + options[i].Value.trim() + "</option>");                
}

I select the desired option from the list

try {
   if (typeof StateToSelect != 'undefined' && StateToSelect != null) {
       $("#" + mStateDDToUpdate).val(StateToSelect);
   }
} catch (ex) {
   alert("Error setting the list.\r\n" + ex.message);
}

The ex.message that was caught was "Could not set the selected property. Unspecified error." The selector does find the object, and the value is in the options. It seems to be a timing thing, because if I add an alert before setting the selected option then there is no exception. I only got this exception when I tested in IE 6.0.3790.3959, not in IE 8.0.6001.18702 or Chrome 13.0.782.112.

I did my best to recreate the whole thing in jsFiddle here:  http://jsfiddle.net/r3g9g/ however, as I mentioned I only see the bug in IE6. Also, I know I don't have all the US states in the list that is not an error.

Change History

comment:1 Changed 22 months ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

IE6 can be picky when it comes to populating select boxes. Inserting options one at at time is a bad idea for performance reasons. Instead, create a new select not in the document and append that to the doc after inserting all the options. Or create that entire select+options as a string and put it in the document as html.

It's probably best to continue this discussion at  http://forum.jquery.com since it's not something jQuery can or will fix a decade after IE6 has shipped.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.