gpt4 book ai didi

javascript - 我需要将图像从一个元素移动到另一个元素

转载 作者:行者123 更新时间:2023-11-28 04:17:01 24 4
gpt4 key购买 nike

我有这个 html 结构。我希望其他字段项与其他字段项放在一起。

<div class="secondary-images">
<div data-quickedit-field-id="node/29/rd_page_secondary_image/da/full" class="group1">
<div class="field__item"></div>
<div class="field__item"></div>
<div class="field__item"></div>
<div class="field__item"></div>
<div class="field__item"></div>
<div class="field__item"></div>
</div>
<div data-quickedit-field-id="node/29/rd_page_secondary_image/da/full" class="group2">
<div class="field__item"></div>
<div class="field__item"></div>
</div>
</div>

我想要这个。

<div class="secondary-images">
<div data-quickedit-field-id="node/29/rd_page_secondary_image/da/full" class="group1">
<div class="field__item"></div>
<div class="field__item"></div>
<div class="field__item"></div>
<div class="field__item"></div>
<div class="field__item"></div>
<div class="field__item"></div>
<div class="field__item"></div>
<div class="field__item"></div>
</div>
<div data-quickedit-field-id="node/29/rd_page_secondary_image/da/full" class="group2">

</div>
</div>

我如何移动元素。我试过了,但没有成功。

var $element = $('.secondary-images > .group2').detach();
$('.secondary-images > .group1').append($element);

最佳答案

<script>
$(document).ready(function() {
$(".group1").append($(".group2").detach());
});
</script>

就在</body>之前

这是一个例子:http://plnkr.co/edit/U6NwzpcYFojCrDkXWMRt?p=preview

关于javascript - 我需要将图像从一个元素移动到另一个元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42283100/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com