jquery - move element after n:th child in javascript -


i'm trying move element class stamp2 after fifth child. attempted. item seems removed.

$('.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> 

drop .remove() bit, use after() move node:

demo

$('section:nth-child(5)').after($('.stamp2')) 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -