A kind friend informed me that I was pretty far off base with this reply. :-) Már, if you see this, could you go ahead and post your correction to the group? I won't get a chance to get back online until later. In the meantime everyone disregard what I said!
Sorry about the bum advice! That's what I get for posting without testing the code... :-) -Mike On Mon, Sep 21, 2009 at 10:25 AM, Michael Geary <m...@mg.to> wrote: > Is this a single-selection or multiple-selection select element? > > If it's single selection, then change: > > $("#mySelect").find("option:selected").text() > > to: > > $("#mySelect").val() > > This will be fast in all browsers, because it uses the .selectedIndex > property from the DOM. It won't help on a multiple selection element, > though. > > For this code: > > $("#mySelect").remove() > > You've probably replaced it with: > > $("#mySelect")[0].innerHTML = ""; > > Is that right? That's what I would do, assuming that there are no jQuery > event handlers on the individual option elements. > > -Mike > > On Mon, Sep 21, 2009 at 7:50 AM, matthew_maxwell < > leftwithoutli...@gmail.com> wrote: > >> >> I've been using jQuery for a little bit now, and have noticed that >> whenever you are attempting to use jQuery on selects with a large >> amount of options, it adds a few seconds of lag to the operation. >> >> An example I ran into was when I had a select of about 4,000 options >> or so (one for every user of my site), and wanted to use jQuery to >> change from a select to a plain text field, using the following: >> >> $("#user").html( $("#mySelect").find("option:selected").text() ); >> >> The time from when the user initiates the change until it actually >> completes is about 1 or 2 seconds. >> >> I notice there's also a delay when it goes to add the select back: >> >> $("#user").html( >> $( myApp.Selects.Users.HTML ).change( >> function () { >> $("#user").html( $("#mySelect").find >> ("option:selected").text() ); >> } >> ) >> ); >> >> The lag time also appears when I go to do a simple remove: >> $("#mySelect").remove(); >> >> When I use the DOM equivalents, though, this works almost instantly. >> >> Just figured I'd give you a heads up. >> >> No other issues, though. Solid library. Good work. >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---