find on large selects

find on large selects


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.