0
我有一个元素var destination
,我试图在它之前插入多个元素。我使用.before
,但我多次使用它,因为我移动了多个元素。.before插入多个元素
有没有办法改善这个代码,并且一次移动所有元素?我正在移动一个元素moveElement
,它之前的元素以及其他一些使用each()
的myClass
类元素。任何方式减少destination.before()
destination.before(moveElement.prev());
destination.before(moveElement);
$('div.myClass').each(function(){
destination.before($(this));
});