How can I fix my jQuery methods so I can re-order the items in a multiselect option control?

Function moveUp() { var select= $('#animalSelector')0; for (var i= 1, n= select.options. Length; i0;) if (select.optionsi. Selected &&!select.

Optionsi+1. Selected) select. InsertBefore(select.

Optionsi+1, select. Optionsi); }.

When I run this in IE7... it takes seconds to move items up and down. Does this not occur for you? Is there any way I can speed it up?

– Markus Nov 12 '10 at 21:47 you could make the select variable global, saving you the trouble of reassigning it each time, but that's not likely to gain you much. Bobince's code is pretty concise. – Prescott Nov 12 '10 at 21:54 I have a feeling it is the insertBefore() in the loop.

Modifying the dom, especially in IE7 is slow. I'm going to somehow have to moveUp/Down the elements in memory, and then replace the entire contents of the select at once. – Markus Nov 12 '10 at 21:59 Seconds?

How large is your options list and how many of its options are selected/moved at once? It's instantaneous for me using your example select of a few animals. – bobince Nov 12 '10 at 11:52.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions