var destination
その前に複数の要素を挿入しようとしている要素があります。使っ.before
ていますが、複数の要素を動かしているので何度も使っています。
このコードを改善し、すべての要素を一度に移動する方法はありますか?要素、その前の要素、およびを使用moveElement
するクラスを持つ他の多くの要素を移動しています。の数を減らすための任意の方法myClass
each()
destination.before()
destination.before(moveElement.prev());
destination.before(moveElement);
$('div.myClass').each(function(){
destination.before($(this));
});