我試圖移動類stam2的元素,所以它是在第五個孩子之後。這是我所嘗試的。該項目似乎被刪除。javascript中的第n個孩子之後的移動元素
$('.stamp2').remove().after('.section:nth-child(5)');
HTML:
<section class="photo small stamp stamp1">..</section>
<section class="photo small stamp stamp2">..</section>
<section class="photo small">..</section>
<section class="photo small">..</section>
<section class="photo small">..</section>
<section class="photo small">..</section>
<section class="photo small">..</section>
<section class="photo small">..</section>
<section class="photo small">..</section>
<section class="photo small">..</section>
<section class="photo small">..</section>
<section class="photo small">..</section>
<section class="photo small">..</section>
<section class="photo small">..</section>
請分享HTML也 –
嘗試'$(」。STAMP2' ).detach()。insertAfter('。section:nth-child(5)');' –
_「該物品似乎已被移除。」_ - 所以你說物品_is_已從原來的位置移除,但不是插入你想要的地方(或其他地方)? – nnnnnn